UIView四个角部分设置圆角

2018-02-05  本文已影响0人  KnowWhy
// 左上角和右上角添加圆角
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;
上一篇 下一篇

猜你喜欢

热点阅读