I have a UIPanGestureRecognizer
I am using to track an object (UIImageView
) below a user\'s finger. I only care about motion on the X axis, and if
You have a couple ways of handling this:
If you were writing a custom pan gesture recognizer subclass, you could easily do this by calling -ignoreTouch:withEvent:
from inside the recognizer when you notice it straying from the area you care about.
Since you're using the standard Pan recognizer, and the touch starts off OK (so you don't want to prevent it with the delegate functions), you really can only make your distinction when you receive the recognizer's target actions. Check the Y value of the translationInView:
or locationInView:
return values, and clamp it appropriately.