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 1: Changing ViewCarTableViewController

Starting with the .h file, follow these steps:

1. Delete the import of ViewCarProtocol.h.

2. Change the delegate to UIViewController *delegate.

3. Add these block properties:

@property (copy, nonatomic) CDCar* (^carToView)(void); @property (copy, nonatomic) void (^carViewDone)(BOOL dataChanged); @property (copy, nonatomic) void (^nextOrPreviousCar)(BOOL isNext);

One thing to notice is that each block property is marked as copy, not strong. This is very important and is related to how blocks work with external variables. Again, for more information, see Chapter 17 of Learning Objective-C by Robert Clair.

Each of the properties declares a block that replaces the same protocol ...

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