通过贝塞尔曲线

作者: 傲骨天成科技 | 来源:发表于2017-06-24 16:06 被阅读238次

这是给UIView写的类别:
-(void)viewWithCornerRadius:(CGFloat)radius {
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(radius, radius)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc]init];
//设置大小
maskLayer.frame = self.bounds;
//设置图形样子
maskLayer.path = maskPath.CGPath;
self.layer.mask = maskLayer;
}

相关文章

网友评论

    本文标题: 通过贝塞尔曲线

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