Graphics Programs Reference
In-Depth Information
UIGestureRecognizerStateCancelled
UIGestureRecognizerStateRecognized
Most of the time, a recognizer will stay in the possible state. When a recognizer recog-
nizes its gesture, it goes into the began state. If the gesture is something that can continue,
like a pan, it will go into and stay in the changed state until it ends. When any of its prop-
erties change, it sends another message to its target. When the gesture ends (typically
when the user lifts the finger), it enters the ended state.
Not all recognizers begin, change, and end. For gesture recognizers that pick up on a dis-
crete gesture like a tap, you will only ever see the recognized state (which has the same
value as the ended state).
Finally, a recognizer can be cancelled (by an incoming phone call, for example) or fail
(because no amount of finger contortion can make the particular gesture from where the
fingers currently are). When these states are transitioned to, the action message of the re-
cognizer is sent, and the state property can be checked to see why.
The three built-in recognizers we did not implement in this chapter are UIPinchGes-
tureRecognizer , UISwipeGestureRecognizer , and UIRotationGes-
tureRecognizer . Each of these have properties that allow you to fine-tune their beha-
vior. The documentation will show you the way.
Finally, if there is a gesture you want to recognize that isn't implemented by the built-in
subclasses of UIGestureRecognizer , you can subclass UIGestureRecognizer
yourself. This is an intense undertaking and outside the scope of this topic. You can read
the Subclassing Notes in the UIGestureRecognizer documentation to learn what's
required.
Search WWH ::




Custom Search