创建任意圆角个数

来源:互联网 发布:bender建模软件 编辑:程序博客网 时间:2024/06/13 19:35

    CGRect rect =CGRectMake(50,50,100,100);

    CGSize radii =CGSizeMake(20,20);

    UIRectCorner corners =UIRectCornerTopRight |UIRectCornerBottomRight |UIRectCornerBottomLeft;

    UIBezierPath *path = [UIBezierPathbezierPathWithRoundedRect:rectbyRoundingCorners:corners cornerRadii:radii];

    

    CAShapeLayer *layer = [CAShapeLayerlayer];

    layer.strokeColor = [UIColorredColor].CGColor;

    layer.lineWidth =5;

    layer.lineJoin =kCALineJoinRound;

    layer.lineCap =kCALineCapRound;

    layer.fillColor = [UIColorblueColor].CGColor;

    layer.path = path.CGPath;


    [self.view.layeraddSublayer:layer];

1 0
原创粉丝点击