美文网首页
绘制任意角的圆角

绘制任意角的圆角

作者: 想想8606 | 来源:发表于2022-05-11 14:33 被阅读0次
- (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;
}

相关文章

网友评论

      本文标题:绘制任意角的圆角

      本文链接:https://www.haomeiwen.com/subject/iobdurtx.html