Moving Through Cars

You need to add a method to move to the next or previous car. The hardest part is figuring out the next row, especially because there can be multiple sections. Next should go to the first car of the next section or wrap around to the beginning of the first section from the last car. Previous should go backward through the list of cars, moving to the last car when a section changes or to the last car from the first car.

Use the project you were using for Chapter 11, “Navigation Controllers II: Split View and the iPad,” or use CH12 CarValet Starter from the sample code from this chapter. First, add code for moving to the next or previous car. There are three routines to do this, shown in Listings 12-1, 12-2, and 12-3. You need ...

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.