UITabBarController: Your App's Main Switchboard

A UITabBarController manages a row of buttons at the bottom of the screen to switch between an app's main sections. Use it for distinct, non-sequential modes like 'Recents,' 'Contacts,' and 'Voicemail'. The footgun is using it for a step-by-step process.
WHY IT EXISTS: Many apps need to present several distinct features or modes to the user at the top level. Instead of every developer building their own custom switching mechanism, UITabBarController provides a standard, user-familiar component for managing navigation between these peer content areas.
THE MENTAL MODEL: Think of a UITabBarController as a physical binder with labeled tabs. Each tab (like "Photos," "For You," "Albums") lets you flip to a completely different section of content. The binder itself (UITabBarController) holds all the sections (child UIViewControllers) together, and the tab bar at the bottom is how you choose which one to view. The key is that the sections are peers; one isn't a sub-section of another.
HOW IT WORKS: You create an instance of UITabBarController and assign an array of UIViewController instances to its viewControllers property. The controller automatically generates a UITabBar at the bottom of its view, creating a UITabBarItem (icon and title) for each child view controller. When a user taps a tab, the UITabBarController displays the view of the corresponding child controller, managing the transition and view lifecycle automatically.
WHEN TO USE IT: Use a UITabBarController for the primary, top-level navigation of your app. It is ideal when you have between two and five distinct functional areas that are peers in the information hierarchy. Good examples are the main screens of the iOS Phone app (Recents, Contacts, Keypad) or a social media app (Feed, Search, Profile).
WHEN NOT TO USE IT: Avoid using a tab bar for a sequential, multi-step task like a checkout process or a setup wizard. The user expects to be able to switch tabs freely, which would break a linear flow. For step-by-step navigation, a UINavigationController is the correct tool. Also, nesting tab bar controllers or putting them deep inside a navigation stack can lead to a confusing user experience.
ONE CANONICAL EXAMPLE: The iOS App Store uses a UITabBarController as its root view. The tabs at the bottom—Today, Games, Apps, Arcade, and Search—represent the five main pillars of the store. Tapping any tab switches to a completely different section, each with its own content and potential sub-navigation, but the main tab bar remains persistent.
Read the original → developer.apple.com
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.