O'Reilly logo

Programming iOS 4 by Matt Neuburg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tab Bar Controllers

A tab bar (a UITabBar, see also Chapter 25) is a horizontal bar displaying items. Each item (a UITabBarItem) consists of an image and a name. At all times, exactly one of these items is selected. When the user taps an item, it becomes the selected item. If there are too many items to fit on the tab bar, the excess items are automatically subsumed into a final More item. When the user taps the More item, a modal list of the excess items appears, and the user can select one; the user can also be permitted to edit the tab bar, determining which items appear in the tab bar itself and which ones spill over into the More list. All of that functionality, if you want it, is more or less automatic.

A tab bar is an independent interface object, but it is most commonly used in conjunction with a view controller (UITabBarController, a subclass of UIViewController). The idea is that the tab bar items should correspond to views; when the user selects a tab bar item, the corresponding view appears. Thus a UITabBarController is an explicit way of letting the user switch between views, using a tab bar, which remains visible and can reveal (through highlighting) which view is currently showing.

A tab bar interface has the advantage that it makes the user’s choices explicit. It has the disadvantage that some screen real estate is occupied by the tab bar, reducing the amount of space available for the views that it summons by about 60 pixels at the bottom, and the tab bar cannot readily ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required