Swiping Through Cars

People expect gestures to be a part of apps, so much so that they try gestures in places where they think they should work. One common navigation gesture is swiping through detailed content. The car images view of the CarValet app already supports swipes, but the detail view does not.

Most of the work of adding swipe gestures is in the supporting code for changing the displayed car. Very little is specific to the swipe. These are the general steps to get swipes working:

1. Add a method for moving back and forth through the cars: nextOrPreviousCar: in CarTableViewController.

2. Enable both car detail controllers to call the new navigation method.

3. Add action selectors for the swipe gestures to the iPhone and iPad car detail ...

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.