///全角设置
UIView *yview = [[UIView alloc] initWithFrame:frame(10, 10, 100, 200)];
yview.backgroundColor = [UIColor whiteColor];
yview.layer.cornerRadius = 3;
yview.layer.masksToBounds = YES;
[self addSubview: yview];
///半角设置
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect: yview.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = yview.bounds;
maskLayer.path = maskPath.CGPath;
yview.layer.mask = maskLayer;
///设置弧度角
* UIRectCornerTopLeft
* UIRectCornerTopRight
* UIRectCornerBottomLeft
* UIRectCornerBottomRight
* UIRectCornerAllCorners
网友评论