- (void)clipCorner:(UIRectCorner)corner radius:(CGFloat)radius{
UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corner cornerRadii:(CGSize){radius}];
CAShapeLayer *layer = self.layer.mask ?: [CAShapeLayer layer];
layer.path = bezierPath.CGPath;
self.layer.mask = layer;
}
网友评论