环境:系统版本:
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 就是左上和右上,可以点进去看枚举,想要哪个角就加
本文介绍了一种使用UIView实现特定圆角效果的方法,通过UIBezierPath和CAShapeLayer结合来实现仅对左上和右上角进行圆角处理的技术细节。
929

被折叠的 条评论
为什么被折叠?



