Graphics Programs Reference
In-Depth Information
For the More Curious: More on UIGestureRecognizer
We've only scratched the surface of UIGestureRecognizer ; there are more sub-
classes, more properties, and more delegate methods, and you can even create recognizers
of your own. This section will give you an idea of what UIGestureRecognizer is cap-
able of, and then you can study the documentation for UIGestureRecognizer to learn
even more.
When a gesture recognizer is on a view, it is really handling all of the UIResponder
methods, like touchesBegan:withEvent: , for you. Gesture recognizers are pretty
greedy, so they typically don't let a view receive touch events or they at least delay the de-
livery of those events. You can set properties on the recognizer, like
delaysTouchesBegan , delaysTouchesEnded , and cancelsTouchesInView ,
to change this behavior. If you need finer control than this all-or-nothing approach, you can
implement delegate methods for the recognizer.
At times, you may have two gesture recognizers looking for very similar gestures. You can
chain recognizers together so that one is required to fail for the next one to start using the
method requireGestureRecognizerToFail: .
One thing you must understand to master gesture recognizers is how they interpret their
state. Overall, there are seven states a recognizer can enter:
UIGestureRecognizerStatePossible
UIGestureRecognizerStateBegan
UIGestureRecognizerStateChanged
UIGestureRecognizerStateEnded
UIGestureRecognizerStateFailed
Search WWH ::




Custom Search