实例代码如下(效果如下图所示):
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;
网友评论