Graphics Programs Reference
In-Depth Information
UIGestureRecognizer Subclasses
You don't instantiate
UIGestureRecognizer
itself. Instead, there are a number of sub-
classes of
UIGestureRecognizer
, and each one is responsible for recognizing a par-
ticular gesture.
To use an instance of a
UIGestureRecognizer
subclass, you give it a target-action
pair and attach it to a view. Whenever the gesture recognizer recognizes its gesture on the
view, it will send the action message to its target. All
UIGestureRecognizer
action
messages have the same form:
- (void)action:(UIGestureRecognizer *)gestureRecognizer;
When recognizing a gesture, the gesture recognizer intercepts the touches destined for the
view (
Figure 20.2
). Thus, a view with gesture recognizers may not receive the typical
UIResponder
messages like
touchesBegan:withEvent:
.
Figure 20.2 UIGestureRecognizers intercept UITouches