Mike A
Mike A

Reputation: 2529

UIGestureRecognizer not receiving touches during UIScrollView deceleration

I've been trying to create a UITextView subclass that handles swiping away the keyboard like in the Message.app.

I have a UIPanGestureRecognizer added to the keyWindow of my app, and the gesture delegate is configured for shouldRecognizeSimultaneouslyWithGestureRecognizer. Everything works fine except for when the UIScrollView is decelerating, during that phase it is possible to pan without the touches being registered.

You can take a look at a very simple github sample project here.

I have tried adding the UIPanGestureRecognizer directly to the viewController.view and to the scrollView, same issue occurs. I have also tried setting scrollView.panGestureRecognizer requireGestureRecognizerToFail: with my UITextView subclass gesture recognizer.

Any ideas as to why this may be happening?

Upvotes: 0

Views: 722

Answers (1)

Olivier
Olivier

Reputation: 387

Instead of creating a new UIPanGestureRecognizer, maybe you could use the one on the UIScrollView, and add your own pan logic to that gesture recognizer with - (void)addTarget:(id)target action:(SEL)action.

Upvotes: 1

Related Questions