iOS 使用贝塞尔曲线切割view

UIBezierPath *maskPath = [UIBezierPath bezierPath];

    [maskPathmoveToPoint:CGPointMake(SCREEN_WIDTH, 13)];

    [maskPathaddLineToPoint:CGPointMake(SCREEN_WIDTH, 15)];

    [maskPathaddLineToPoint:CGPointMake(0, 15)];

    [maskPathaddLineToPoint:CGPointMake(0, 13)];

//加规则弧线

    [maskPathaddQuadCurveToPoint:CGPointMake(SCREEN_WIDTH, 13) controlPoint:CGPointMake(SCREEN_WIDTH/2, 0)];

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

    maskLayer.frame=self.xxxView.bounds;

    maskLayer.path= maskPath.CGPath;

    self.xxxView.layer.mask= maskLayer;

效果如下:

你可能感兴趣的:(iOS 使用贝塞尔曲线切割view)