iamarnold
iamarnold

Reputation: 229

UIPanGestureRecognizer not recognizing pan small movements(<3mm)

I'm trying to use UIPanGestureRecognizer to drag something around the screen. The problem is that when trying the drag, the gesture isn't recognized until I moved a certain amount(>3mm) across the screen. If I tap & hold on my object and make small movements(<3mm) back and forth, it's not recognized as a pan gesture. There's not problem if I use TouchesBegan where it recognized immediate my tap & hold. Is there anyway around this or I'm forced to use TouchesBegan?.

Upvotes: 4

Views: 228

Answers (1)

Rob
Rob

Reputation: 437492

You can, alternatively, use a UILongPressGestureRecognizer, but set its minimumPressDuration to something very small and its allowableMovement to something very large. The long press gesture recognizer won't calculate translationInView for you, but that's not hard to do yourself, and the long press gesture recognizer is a continuous gesture recognizer, much like the pan gesture recognizer.

If this feels too kludgy, you always can make your own gesture recognizer, but a properly configured long press gesture recognizer might be adequate for your purposes.

Upvotes: 2

Related Questions