7.4 · Navigation, tab, split and page controllers

Most apps are a few container controllers arranged around your screens. Knowing how each one owns its children is how you avoid state that mysteriously resets.

Mental model. A container owns its children’s lifetime and layout, not their content. Each screen still decides what it shows; the container decides which one is on screen and how you move between them.

Stacks and tabs

The two containers almost every app uses.

  1. How does UINavigationController manage its stack, and where do the bar items and back button come from? 7.4.1 · L2
    A navigation controller holds an ordered array, viewControllers, with topViewController on screen. pushViewController(_:animated:) adds one, popViewController…
  2. How do UITabBarController, UISplitViewController and UIPageViewController differ, and what loads when? 7.4.2 · L2
    A tab bar controller shows one of its child controllers at a time, switched from the bar. Each tab is usually its own navigation controller, so each keeps an…

More in UIKit