I'm trying to build some iOS apps while learning and am having some trouble understanding the proper way to do this.
What I have currently is a view that is a subclass of UIView. It is clear and I want to use it as a drawing surface. It will sit on top of something else, like tracing paper.
The user should be able to click on one spot then another spot and a line should draw between the 2 points. I'm getting the touch data, I have the points, and I am able to draw stuff from inside of drawRect: initially.
The problem is I'm not sure how to update stuff later. When everything loads up and drawRect: is calle, it will draw a line just fine. But how do I make it draw new stuff or alter stuff that is already drawn based on what the user is doing. I know I need to call setNeedsDisplay, but not how to get the data to the view to draw stuff.
I've read a bunch of tutorials/examples and they all stop at "Override drawRect: and draw some stuff... done!". How do I pass data down in to the view to tell it "hey, redraw this stuff and add this new line".
Or am I going about this all the wrong way?
EDIT: I'll try to explain better the setup I have.
I have a VC. Inside this VC's view I have a toolbar at the bottom. The rest of the area is taken up by 2 views. One is an image view that holds a reference image. One is the custom view that is clear (tracing paper) that sits at the top. They click a button on the toolbar which turns on a gesturerecognizer. They click on the screen, and I collect the tap data, turn off the gesturerecognizer and HOPEFULLY draw a line. I've got it all working except the drawing part.