UIView实现任意角裁剪圆角

来源:互联网 发布:jquery.poshytip.js 编辑:程序博客网 时间:2024/04/28 00:05

环境:系统版本:

OSX 10.11.4

Xcodel版本:7.3.1

功能:UIView实现任意角裁剪圆角


// 上左上右圆角- (void)radiusWithTopLeftAndTopRightRadius:(CGFloat)radius{    UIBezierPath *round = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(radius, radius)];    CAShapeLayer *shape = [[CAShapeLayer alloc]init];    [shape setPath:round.CGPath];    self.layer.mask = shape;}

其中
UIRectCornerTopLeft | UIRectCornerTopRight 就是左上和右上,可以点进去看枚举,想要哪个角就加

0 0
原创粉丝点击