5
votes

I added a UIView that relied on TouchesMoved: events to drag touches. There's a long press, tap, rotate and pinch gesture recognizers already present within the same view controller. I'm running into an issue where the view receives touchesBegan: and touchesEnded: events, but no touches moved.

Is my issue with touchesMoved not being called being caused by gesture recognizers cancelling touches within the view? I also got a scroll view involved. Could that be the culprit?

If I will not be able to use touchesMoved, which is the closest gesture to implement the "touch and move" functionality. Is it tap or pan gesture recognizer?

Thank you for your help!

2

2 Answers

14
votes

Gestures by default cancel the touches in the object they are linked to when they are active. You can stop this behavior by setting the cancelsTouchesInView property to NO.

2
votes

Mixing raw touch handling with gesture recognizers might yield strange behaviors, at least I was not able to get it working solidly, it was somewhat flaky. In your situation, you might just want to add a drag gesture recognizer (UIPanGestureRecognizer) to the view to handle the drags.

You can control the mechanism of which gesture recognizers fire in which situations by looking into gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: of UIGestureRecognizerDelegate.