I'm writing a program for iPhone that will first let the user take a photo, then will dynamically retrieve a colour of the place where the user taps on the image, and draw a rectangle of that colour. I have two relevant classes for this: AppViewController
and AppView
. The former contains all the UI elements and IBActions, the latter the position of last tap, the touches-handling methods and the drawRect
(and a static method to get colour data at a given coords of an image).
What I wanted to do is to put the touch-handling (calling drawRect
in touchesMoved
/Ended
) and the drawRect
in the AppViewController
. That doesn't work, since that class doesn't inherit from UIView
, but from UIViewController
. What's the correct way to do that?
Another way to phrase that: How to constantly change something (well, constantly as long as the user is swiping across the screen) in a class that doesn't support touch-detection methods?
(This probably doesn't explain it well. Please ask clarifying questions).