O'Reilly logo

Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming by Erica Sadun, Rod Strougo, Maurice Sharp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Step 4: Updating MainMenuViewController

This class only uses the protocol for going to the next or previous car, so there are two simple updates:

1. In the .h file, remove the two uses of ViewCarProtocol.

2. In the .m file, tableView:didSelectRowAtIndexPath: has a small change. In the switch case for kPadMenuCarsItem, replace the line:

currentCarDetailController.delegate = carTable;

with this:

currentCarDetailController.nextOrPreviousCar = ^(BOOL isNext)                             {[carTable nextOrPreviousCar:isNext];};

This change uses blocks copying in scope variables to include carTable, a reference to the master cars table menu. Since carTable implements nextOrPreviousCar:, and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required