Graphics Programs Reference
In-Depth Information
20
UIGestureRecognizer and UIMenuController
In
Chapter 19
,
you handled raw touches and determined their course by implementing
methods from
UIResponder
. Sometimes, you want to detect a specific pattern of touches
that make a gesture, like a pinch or a swipe. Instead of writing code to detect common ges-
tures yourself, you can use instances of
UIGestureRecognizer
.
A
UIGestureRecognizer
intercepts touches that are on their way to being handled by
a view. When it recognizes a particular gesture, it sends a message to the object of your
choice. There are several types of gesture recognizers built into the SDK. In this chapter,
we will use three of them to allow
TouchTracker
users to select, move, and delete lines.
We'll also see how to use another interesting iOS class,
UIMenuController
.
Figure 20.1 TouchTracker by the end of the chapter