部分圆角
新建UIView分类
- (void)setPartRoundWithCorners:(UIRectCorner)corners cornerRadius:(float)cornerRadius{
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(cornerRadius, cornerRadius)].CGPath;
self.layer.mask = shapeLayer;
}
使用
[view setPartRoundWithCorners:UIRectCornerTopLeft|UIRectCornerTopRight cornerRadius:20];
网友评论