Lesson 15
Navigation Controllers
A navigation controller is a class that manages the presentation of a stack of view controllers one at a time. The topmost item on the stack is visible, and users can navigate down the stack one view controller at a time. Whenever a view controller is pushed on—or off the navigation controller's stack—iOS applies an appropriate slide animation automatically. Navigation controllers are implemented in the
class in the UINavigationController
framework and can be found in several standard applications such as the iOS Mail, and Settings apps.UIKit
Adding a Navigation Controller to a Storyboard
To create a navigation controller using the interface editor, simply select the storyboard scene that you want to use as the root view controller of the navigation stack and select Editor Embed In Navigation Controller. You can optionally drag a Navigation Controller object from the Object library to the storyboard. When you create a navigation controller in this manner, Xcode creates a default scene that is set up to act as the root view controller for the navigation controller (see Figure 15.1).
In most cases, you will want to use one of the ...
Get Swift iOS 24-Hour Trainer 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.