绘制任意角的圆角

2022-05-11  本文已影响0人  想想8606
- (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;
}
上一篇下一篇

猜你喜欢

热点阅读