iOS OC 设置上下左右的圆角

以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;

你可能感兴趣的:(iOS OC 设置上下左右的圆角)