UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:view2.bounds byRoundingCorners:UIRectCornerBottomRight | UIRectCornerTopRight cornerRadii:CGSizeMake(40, 40)];
// 这里 40 40 表示圆弧的角度 前面的参数有四个类型 左上角 左下角 右上角 右下角
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = view2.bounds;
maskLayer.path = maskPath.CGPath;
view2.layer.mask = maskLayer;
转载于:https://blog.51cto.com/9951038/1852327