Recognizer States

Gesture recognizers are in one of four states—or seven, if they are continuously sending updates. Their default state is that the gesture is possible, even if there are no fingers on the screen. This might seem strange, but it is very important. When fingers touch down, the system only checks gestures that could recognize something (and are enabled). Therefore, UIGestureRecognitionPossible is the default state for all recognizers.

Single gestures track touch(es) until the gesture is either recognized, not possible to recognize, or cancelled. Continuous gestures add states for sending messages to their delegate and for resetting to some default state. Figure 12-6 shows the two different flows.

Figure 12-6 Stroke state diagrams ...

Get Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.