How to remove CAShapeLayer along user drag?

2019-09-12 11:14发布

问题:

I am new to painting app ,so please suggest me is there any way to remove.

i was googled i am only getting

  CGContextSetBlendMode(_context, kCGBlendModeClear);

but not for CAShape layer

UIBezierPath *path = [UIBezierPath bezierPath];
    [path moveToPoint:CGPointMake(touchPoint.x,touchPoint.y)];
    [path addLineToPoint:CGPointMake(startingPoint.x,startingPoint.y)];

    CAShapeLayer *shapeLayer = [CAShapeLayer layer];

    shapeLayer.path = [path CGPath];
//    shapeLayer.strokeColor =kCGBlendModeClear;

    if([UIDevice currentDevice].userInterfaceIdiom ==UIUserInterfaceIdiomPad)
    {
        shapeLayer.lineWidth = 7.0;

    }
    else
    {
        shapeLayer.lineWidth = 5.0;

    }
    shapeLayer.fillColor = [[UIColor clearColor] CGColor];
    [self.layer addSublayer:shapeLayer];
    [clearBeizer addObject:shapeLayer];

please help me to remove that layer thanks.