Implementing the DetailController Singleton

In addition to implementing the split view controller delegate protocol, the new class eventually manages the detail content. And even if it did not, most of the changes made by a split view delegate are to the detail view.

First, you implement the singleton functionality:

1. Add a new class called DetailController, based on NSObject, to the bottom of the iPad group.

2. Open DetailController.h and add the following line just above the @end statement. The + sign indicates a class method:

+ (DetailController*)sharedDetailController;

3. Set the contents of DetailController.m to the code shown in Listing 11-3.

Listing 11-3 Detail Controller Implementation

Get Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.