iOS 贝塞尔曲线切圆角

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

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 贝塞尔曲线切圆角)