这种方式可以控制四个角的圆角属性。 typedef NS_OPTIONS(NSUInteger, UIRectCorner) { UIRectCornerTopLeft = 1 << 0, UIRectCornerTopRight = 1 << 1, UIRectCornerBottomLeft = 1 << 2, UIRectCornerBottomRight = 1 << 3, UIRectCornerAllCorners = ~0UL }; CGRect rect = CGRectMake(0, 0, ScreenWidth - PADDING *2, 44); CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = rect; UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(3, 3)]; maskLayer.path = maskPath.CGPath; cell.maskLayer = maskLayer; |
本文出自 “ZhuoKing” 博客,请务必保留此出处http://9951038.blog.51cto.com/9941038/1746342
原文地址:http://9951038.blog.51cto.com/9941038/1746342