Just toying with the SDK and I was wondering if possible a UITouch event can work inside a UIScrollView.
I have setup a UIScrollView which handles a large UIView, inside the UIView is a UIImageView, I've managed to get the UITouch to drag the UIImageView outside of the UIScrollView but inside it's not registering the event.
I suppose what I was trying to accomplish was dragging the UIImageView around the large UIView whilst the UIScrollView moves along the image if the user drags it beyond the POS of when the UIView when the UIImageView began it's dragging, if that makes sense?
Many thanks
The best way to implement this I found was to subclass the uiscrollview class itself and then add the touches began event method in the your subclass. This worked for me.
(If I understood the question correctly)
UIScrollView intercepts
touchMoved
events and does not propagate them to its contents if scrolling is enabled. So to do the dragging in the UIScrollView contents in my app I did the following trick:touchesBegan: Check if you touch the "draggable" region. If YES - disable scrolling in UIScrollView.
touchesMoved: Now as scrolling is disabled your contents view receives this event and you can move your draggable UIImageView accordingly.
touchesEnded: Reenable scrolling in UIScrolliew.
If you want to drag the view outside of the visible UIScrollView area you may also need to check manually if you're near the boundaries and manually adjust contents offset (I didn't try this myself but I think it should work).