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

Creating and Printing Cars

You now have a Car class in your CarValet project, but it is not called or used anywhere in your app. Open up the ViewController.m implementation file and follow these steps:

1. Add the #import "Car.h" statement below the last import at the top of the ViewController.m file.

2. Add the viewWillAppear: method in Listing 2-8 below the viewDidLoad method.

Listing 2-8 ViewController.m viewWillAppear: Method

- (void)viewWillAppear:(BOOL)animated {     [super viewWillAppear:animated];     Car *myCar = [[Car alloc] init];                        // 1     [myCar printCarInfo];                                   // 2     myCar.make = @"Ford";                                   // 3     myCar.model ...

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