Adding a Gesture Recognizer
If you want to truly understand the iPad user experience, you need to understand the importance of gestures, one of the features that make the use of the device an intimate experience for the user, as I explain in Chapter 1.
UIKit includes gesture recognizers that you can use in your app to make it work the same way as all those fancy apps Apple has come up with. In this section, you’ll use
UIKit to add a gesture recognizer to the Main view so that the user can swipe to the left to make the Test Drive view appear.
Adding the gesture recognizer is easy. In
RTMasterViewController.m, add the bolded code in Listing 13-1 to
Listing 13-1: Adding a Gesture Recognizer
RTAppDelegate* appDelegate =
[[UIApplication sharedApplication] delegate];
self.title = appDelegate.trip.destinationName;
UIImageView* imageView = [[UIImageView alloc]
self.tableView.backgroundView = imageView;
UISwipeGestureRecognizer *swipeGesture =
[[UISwipeGestureRecognizer alloc] initWithTarget:self
UISwipeGestureRecognizer is a subclass of
UIGestureRecognizer — the abstract base class for concrete gesture-recognizer classes. The gesture recognizer does the hard work of recognizing a specific gesture and then ...