Adding a Background Image and Title
The type of Table view highlighted in this chapter has static cells that you set up in Interface Builder, as I mention in the previous section. However, in this view, everything isn’t static — including two things based on the destination. Those two things are the background image and the title. You have to set those programmatically.
Start by hiding the Utility area and then show the Project navigator (if you have hidden it) by making the appropriate selections in the toolbar. Then select
RTMasterViewController.m in the Project navigator.
You may recall from Chapter 6 that the View Controller method you’d use to customize a view at launch time is
viewDidLoad, which is the method I’ll have you use here as well.
First, import the headers you need by adding the bolded code in Listing 12-1 to
Listing 12-1: Updating the RTMasterViewController Implementation
Now add the bolded code in Listing 12-2 to the
viewDidLoad method in
RTMasterViewController.m and delete the commented out code in bold, underline, and italic.
Listing 12-2: Updating viewDidLoad
//self.title = @”Road Trip”;
RTAppDelegate* appDelegate = [[UIApplication
self.title = appDelegate.trip.destinationName;
UIImageView* imageView = [[UIImageView alloc]