Cover by Joe Conway, Aaron Hillegass

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

UIPanGestureRecognizer and Simultaneous Recognizers

Once a line is selected during a long press, we want the user to be able to move that line around the screen by dragging it with a finger. So we need a gesture recognizer for a finger moving around the screen. This gesture is called panning, and its gesture recognizer subclass is UIPanGestureRecognizer.

Normally, a gesture recognizer does not share the touches it intercepts. Once it has recognized its gesture, it eats that touch, and no other recognizer gets a chance to handle it. In our case, this is bad: the entire pan gesture we want to recognize happens within a long press gesture. We need the long press recognizer and the pan recognizer to be able to recognize their gestures simultaneously. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required