码迷,mamicode.com
首页 > 移动开发 > 详细

iOS 琐碎点------切某个或某几个角的圆角

时间:2016-08-30 18:05:13      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:

 

不说废话---------->

1.如果是切四个角的圆角,代码示例:

self.picImage.layer.cornerRadius = 8;

self.picImage.layer.masksToBounds = YES;

 

2.如果是四个角中的某几个角,一个,两个,或者3个,代码示例(切的左下,和右下):

UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.tipLabel.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(5, 5)];

CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];

maskLayer.frame = _tipLabel.bounds;

maskLayer.path = maskPath.CGPath;

self.tipLabel.layer.mask = maskLayer;

 ==================================

类型共有以下几种:

* UIRectCornerTopLeft

* UIRectCornerTopRight

* UIRectCornerBottomLeft

* UIRectCornerBottomRight

* UIRectCornerAllCorners

 

iOS 琐碎点------切某个或某几个角的圆角

标签:

原文地址:http://www.cnblogs.com/liuzicheng/p/5822756.html

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