I've seen similar questions here, but I haven't seen a solid answer to my question directly.
I have a UIScrollView
that contains a UIImageView
object. That view can be zoomed in to view more details on a given photo. When I am zoomed in at any level, panning works as expected. Pinch to zoom works as expected as well.
Now, I want to add another view on top of that image (such as a drawing), but also within the scrollView, so that whenever the scrollView zooms/pans, so does this new drawn view (resizes with zoom)--let's call this drawnView.
Think of this as annotating a picture. I'm viewing an image. I can zoom in/out on the image and pan around to find exactly what I'm looking for. Then, I can draw something on it (no details needed here, this is all working find). But, say I need to move it just a little bit. I want to touch and drag it to a different location.
Whenever I touch to drag the drawnView, I want to be able to drag it around without any delay. I really don't want to use a UILongPressGestureRecognizer
. I'd rather use a UIPanGestureRecognizer
. Now, so long as the scrollView is NOT zoomed in at all (zoom factor is 1.0f), the UIPanGestureRecognizer
on my drawnView works just fine. However, as soon as I zoom in at all in the scrollView, the scrollView's UIPanGestureRecognizer
gets triggered first.
I don't understand why this is the case. My drawnView has userInterationEnabled = TRUE
, and it's visible, so why doesn't it get the pan gesture first?