Creating and Responding to the Gesture Recognizer

All you have to do now is add the action method, create the gesture recognizer, and add it to the detail controller. Follow these steps:

1. Import ReturnGestureRecognizer.h into MainMenuViewController.m.

2. Add the code in Listing 12-10 below carViewDone:.

3. Update viewDidLoad to allocate a gesture recognizer and then set the detail controller’s returnGesture property. Add the following code to the end of the method:

ReturnGestureRecognizer *returnGesture = [[ReturnGestureRecognizer alloc]                                           initWithTarget:self                                           action:@selector(returnHome:)]; [DetailController sharedDetailController].returnGesture ...

Get Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.