If you have an image as background, then you can draw the image as a pattern on bezierpath and it will virtually give you an eraser effect. It works :) brushPattern=[[UIColor alloc]initWithPatternImage:[UIImage imageNamed:@"image.jpg"]];
// Here image.jpg is your background image
The eraser effectively draws a line that is one color, each on top of the background of an already drawn path. What you might want to note is that it is an eraser line so that if the background color changes otherwise you lose the erase you can update the eraser line's stroke color.
Based on your answer to Jeremy, it seems like you are trying to do the dotted line. you setLineDash:number:phase: UIBezierPath *path = [UIBezierPath new];
If you have an image as background, then you can draw the image as a pattern on bezierpath and it will virtually give you an eraser effect. It works :)
brushPattern=[[UIColor alloc]initWithPatternImage:[UIImage imageNamed:@"image.jpg"]];
// Here image.jpg is your background image
The eraser effectively draws a line that is one color, each on top of the background of an already drawn path. What you might want to note is that it is an eraser line so that if the background color changes otherwise you lose the erase you can update the eraser line's stroke color.
Based on your answer to Jeremy, it seems like you are trying to do the dotted line. you setLineDash:number:phase:
UIBezierPath *path = [UIBezierPath new];
CGFloat dashArray[3];
dashArray[0] = 8;
dashArray[1] = 3;
dashArray[2] = 8;
[path setLineDash:dashArray count:dashCount phase: 0.0];