An item in a tab bar.
- iOS 2.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
A tab bar operates strictly in radio mode, where one item is selected at a time—tapping a tab bar item toggles the view above the tab bar. You can also specify a badge value on the tab bar item for adding additional visual information—for example, the Messages app uses a badge on the item to show the number of new messages. This class also provides a number of system defaults for creating items.
init(tab method to create one of the system items. Use the
init(title: method to create a custom item with the specified title and image, which is used as both the unselected and selected image. Use the
init(title: method to create a custom item with the specified title, unselected image, and selected image.
In iOS v5.0 and later, you can customize the appearance of tab bars by setting item label text attributes using appearance selectors declared by
UIBar. You can also use the methods listed in Customizing the Item's Appearance. You can customize the appearance of all tab bar items using the appearance proxy (for example,
[UITab), or just of a single tab bar item.
By default, unselected and selected images are automatically created from the alpha values in the source images. To prevent system coloring, provide images with
For more information about appearance and behavior configuration, see Tab Bars.