美文网首页
iOS之任意圆角

iOS之任意圆角

作者: 张大普奔 | 来源:发表于2017-02-28 14:02 被阅读23次

例如给一个view加圆角:

UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
CGFloat corner = 6;
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:UIRectCornerTopLeft |   UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(corner, corner)].CGPath;
view.layer.mask = shapeLayer;

相关文章

网友评论

      本文标题:iOS之任意圆角

      本文链接:https://www.haomeiwen.com/subject/xjyxgttx.html