以UILabel为例:
UIBezierPath * maskPath = [UIBezierPath bezierPathWithRoundedRect:label.bounds byRoundingCorners:UIRectCornerBottomLeft|UIRectCornerTopLeft cornerRadii:CGSizeMake(3, 3)];
CAShapeLayer * maskLayer = [[CAShapeLayer alloc]init];
maskLayer.frame = label.bounds;
maskLayer.path = maskPath.CGPath;
label.layer.mask = maskLayer;
网友评论