Adding Action Selectors

You now have almost all the code changes needed to support swipes: The car table can move to the next or previous car, and both the iPhone and iPad car detail views can call the new method. The last new code is the selectors used by the swipe gestures.

All the work for the iPad selectors is done by nextOrPreviousCar:, which contains code for updating the state of the delegate—in this case, the iPad car detail view. Add the code in Listing 12-5 above the utility method #pragma in CarDetailViewController.m.

Listing 12-5 iPad Car Detail Swipe Gesture Recognizers

#pragma mark - Gestures - (IBAction)swipeCarRight:(UISwipeGestureRecognizer*)sender {               // 1     [self.delegate nextOrPreviousCar:YES];                                  // ...

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.