I have implemented drawing line on UIView( it's background is transparent.) using UIBezierPath.
For drawing line, I have used following code in - (void)drawRect:(CGRect)rect
method:-
UIBezierPath *_path = [pathArray objectAtIndex:0];
[currentColor setStroke];
[_path strokeWithBlendMode:kCGBlendModeNormal alpha:1.0];
Here pathArray is array of multiple UIBezierPath objects.
For erasing draw, I have used following code in - (void)drawRect:(CGRect)rect
method:-
UIBezierPath *_path = [pathArray objectAtIndex:10];
[[UIColor clearColor] setStroke];
[_path strokeWithBlendMode:kCGBlendModeClear alpha:1.0];
Above both method working well while drawing on transparent UIView. But while i am drawing on UIView with white background color, there is black color appeared where i have erased draw. Also same problem appeared while capture screenshot of drawing view. Any solution?
See following screenshots of same drawing, you will get it clear.