不说废话---------->
1.如果是切四个角的圆角,代码示例:
self.picImage.layer.cornerRadius = 8;
self.picImage.layer.masksToBounds = YES;
2.如果是四个角中的某几个角,一个,两个,或者3个,代码示例(切的左下,和右下):
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.tipLabel.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(5, 5)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = _tipLabel.bounds;
maskLayer.path = maskPath.CGPath;
self.tipLabel.layer.mask = maskLayer;
==================================
类型共有以下几种:
* UIRectCornerTopLeft
* UIRectCornerTopRight
* UIRectCornerBottomLeft
* UIRectCornerBottomRight
* UIRectCornerAllCorners
时间: 2024-11-05 16:01:46