How to Add the Events Controller to Your iOS App

By Jesse Feiler

You can add the Events controller to your iOS app, which will display events that you might be interested in at your destination. Interestingly enough, for the Events controller to work properly, you’ll need to have it embedded in a Navigation controller.

To add an Events controller, do the following:

1Select a new view controller from the Objects section of the Library pane.

Drag it onto your storyboard.

2In the Attributes inspector, enter Events in the view controller’s Title field, as well as in the Identity inspector’s Storyboard ID field.

Make sure the new Events view controller is selected.

Xcode's Editor drop down menu.

3With the new Events view controller selected, choose Editor→Embed In→Navigation Controller from the main menu.

A navigation controller scene is added to your storyboard, along with something called a Relationship from UINavigation Controller to ViewController . The navigator and related Events view controller are linked by the relationship, but, at this time, they have no other connections to other view controllers.

Selecting the navigation controllers for an app in Xcode.

4Select the Navigation controller in the canvas, and in the Attributes inspector, enter EventsNavigation in the Title field as well as in the Identity inspector’s Storyboard ID field for the Navigation controller so you can find it for the next step.

You can see that, in the Document Outline and on the Canvas, the Navigation controller is now identified as EventsNavigation.

Now you’ll want to create a segue from the Events cell to the Navigation controller.

Selecting the Events cell in the Master View controller

5In the Document Outline, select the Events cell in the Master View controller (it’s there under the TableView Section – At my Destination under the Table View heading) and Control-drag to the Navigation controller you just added — the one in which you embedded the Events controller and named in Step 4.

You can see all the action. Note that you may need to rearrange things to connect the table cell to the view controller. After connection is made, you can rearrange things.

It is easier to do this from the Document Outline.

6Select Replace from the Storyboard Segues pop-up menu that appears.

For iPhone, you will use Push rather than Replace.

An app's storyboard in Xcode.

7Select the segue on the Canvas and, in the Attributes inspector, enter Events in the Identifier field and choose Detail Split from the Destination drop-down menu.

Your storyboard should look like this when you’re done. (Note that for iPhone, you will use a Push segue and not use Detail Split.)

8Select the Events Table View cell.

In the Attributes inspector’s Accessory field, make sure the Accessory has been set to None.