码迷,mamicode.com
首页 > 其他好文 > 详细

将view指定的角设置为圆角

时间:2016-04-20 19:57:47      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:

UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 80, 80)]; 
view.backgroundColor = [UIColor redColor]; 
[self.view addSubview:view];

 UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(5, 5)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; 
maskLayer.frame = view.bounds; 
maskLayer.path = maskPath.CGPath; 
view.layer.mask = maskLayer;    

将view指定的角设置为圆角

标签:

原文地址:http://www.cnblogs.com/siasyl/p/5413909.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!