美文网首页
UIView四个角部分设置圆角

UIView四个角部分设置圆角

作者: KnowWhy | 来源:发表于2018-02-05 16:22 被阅读0次
// 左上角和右上角添加圆角
UIView *customView = [[UIView alloc] initWithFrame:CGRectMake(10, 10, 200, 300)];
UIRectCorner corner = UIRectCornerTopLeft | UIRectCornerTopRight;
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:customView.bounds
                                           byRoundingCorners:corner
                                                 cornerRadii:CGSizeMake(12, 12)];
CAShapeLayer *layer = [[CAShapeLayer alloc] init];
layer.frame = customView.bounds;
layer.path = path.CGPath;
customView.layer.mask = layer;

相关文章

网友评论

      本文标题:UIView四个角部分设置圆角

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