I would like to learn how to create a simple drawing app for iOS. I can get to the point of actually drawing the line with a UIBezierPath. I've created a custom view and I use drawRect: to stroke the UIBezierPaths (it's not the most efficient, because I'm drawing every line every time. Once I get the basics, I'll drill down into more efficient implementations).
My question is this: how do I implement an eraser function? I don't want a simple hack like using a path with a white stroke color; I want a legit erase function. I can't figure out how to do this, and I have searched many resources online for this. Some ideas I've had are hit testing to erase certain points in a line and drawing a special "eraser" line that does some sort of blending to erase other lines. I don't think the latter is possible, and I have no idea how to implement the former, or if it's even possible.
Does anyone have some insight they can share on this?