View自定义圆角-(贝塞尔曲线实现)

View自定义圆角-(贝塞尔曲线实现)_第1张图片

实例代码如下(效果如下图所示):

UIBezierPath *maskPath =  [UIBezierPath bezierPathWithRoundedRect:self.contentView.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)];

CAShapeLayer *mackLayer = [[CAShapeLayer alloc] init];

mackLayer.frame = self.contentView.bounds;

mackLayer.path = maskPath.CGPath;

self.contentView.layer.mask = mackLayer;


View自定义圆角-(贝塞尔曲线实现)_第2张图片

你可能感兴趣的:(View自定义圆角-(贝塞尔曲线实现))