美文网首页ios实用开发技巧
iOS 贝塞尔曲线切圆角

iOS 贝塞尔曲线切圆角

作者: 隔墙送来秋千影 | 来源:发表于2019-04-22 11:40 被阅读60次

图片很多的时候还是用这个靠点谱

UIBezierPath *backBezierPath = [UIBezierPath bezierPathWithRoundedRect:self.view.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:self.view.bounds.size];
CAShapeLayer *backLayer=[CAShapeLayer layer];
backLayer.frame=self.view.bounds;
backLayer.path=backBezierPath.CGPath;
self.view.layer.mask=backLayer;
[self addSubview:self.view];

图片少的时候直接传统的切圆角就完事

UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 50, 70, 70)];
imgView.layer.masksToBounds = YES;
imgView.layer.cornerRadius = imgView.width/2;
[self.view addSubview:imgView];

相关文章

网友评论

    本文标题:iOS 贝塞尔曲线切圆角

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