UIView

作者: 夜雨聲煩_ | 来源:发表于2020-08-06 14:20 被阅读0次

部分圆角

新建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];

相关文章

网友评论

      本文标题:UIView

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