UIPanGestureRecognizer does not recognize small movements (<3 mm)
I am trying to use UIPanGestureRecognizer
to drag and drop something around the screen. The problem is that when I try to drag, the gesture is not recognized until I have moved one to the screen amount(>3mm)
. If I touch an object and make a small movements(<3mm)
back and forth, it won't be recognized as a pan gesture. There is no problem if I use TouchesBegan
where it immediately recognizes my tap and holds. Anyway, around this or I have to use TouchesBegan?
.
source share
Alternatively you can use UILongPressGestureRecognizer
but set it minimumPressDuration
to something very small and its allowableMovement
to something very large. The long gesture recognizer won't compute translationInView
for you, but it's not hard to do it yourself, and the long press gesture recognizer is a continuous gesture recognizer, very similar to the gesture recognizer.
If that sounds too silly, you can always make your own gesture recognizer, but a properly configured long gesture recognizer might be fine for your purposes.
source share