Navigation Controllers

Let’s take stock of where we are with our app. We have two scenes—the episodes list and the media player—that currently have no relationship to one another. The only reason either works is that we reset the “Is initial view controller” setting in the AppDelegate. But what we want, of course, is for selecting an episode in the table to bring up the player for that episode. We need to navigate from one scene to the other.

The most common tool for achieving this on iOS is the UINavigationController, a view controller that manages a stack of other view controllers. Typically, it starts with a “root” view controller, and then when we want to show another view controller, we put the new one on the top stack. When we want to ...

Get iOS 10 SDK Development, 1st Edition 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.