How Add the Custom View Controller for the DestinationController in Your iOS App

By Neal Goldstein, Dave Wilson

What if you want your iOS app user to be able to choose a destination? Follow these steps to add a new Objective-C DestinationController class to your iOS app project.

  1. In the Project navigator, select the View Controller Classes group and then either right-click the selection and choose New File from the menu that appears or choose File→New→New File from the main menu (or press ⌘+N).

    Whatever method you choose, you’re greeted by the New File dialog.

  2. In the left column of the dialog, select Cocoa Touch under the iOS heading, select the Objective-C class template in the top-right pane, and then click Next.

    You’ll see a dialog that will enable you to choose the options for your file.

  3. Enter DestinationController in the Class field, enter or choose UIViewController from the Subclass Of drop-down menu, make sure that the Target for iPad check box is selected and that With XIB for User Interface is deselected, and then click Next.

  4. In the Save sheet that appears, click Create.

The Destination controller will be using a Table view, but it won’t use a Table View Controller class. That’s because you can use a Table view with dynamically generated cells as only one element in the view. This is a handy thing to know if you want to take advantage of the power of a Table view without letting a Table view take over the entire screen.