This is my coding to draw a line using CAShapeLayer .no i like to remove the CAShapeLayer along user drag.
UIBezierPath *path = [UIBezierPath bezierPath];
[path moveToPoint:CGPointMake(touchPoint.x,touchPoint.y)];
[path addLineToPoint:CGPointMake(startingPoint.x,startingPoint.y)];
shapeLayer = [CAShapeLayer layer];
shapeLayer.lineCap=kCALineCapSquare;
shapeLayer.path = [path CGPath];
shapeLayer.lineWidth = single.width;
shapeLayer.fillColor = [[UIColor redColor] CGColor];
[self.layer addSublayer:shapeLayer];
[clearBeizer addObject:shapeLayer];
This is screenshot of my expectation:
now i like to remove the cashapelayer along user touch like this