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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.