Created
May 4, 2014 06:11
-
-
Save nonstriater/20ddc933f6147265f6dd to your computer and use it in GitHub Desktop.
为UIView设置圆角(小于4个角)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
为UIView设置圆角(小于4个角) UIBezi erPath + UIShapeLayer | |
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:view2.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)]; // byRoundingCorners : 指定需要圆角的角,UIRectCorner类型 | |
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; | |
maskLayer.frame = view2.bounds; | |
maskLayer.path = maskPath.CGPath; | |
view2.layer.mask = maskLayer; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment