Class

UITabBarItem

An item in a tab bar.

Declaration

@interface UITabBarItem : UIBarItem

Overview

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.

Use the initWithTabBarSystemItem:tag: method to create one of the system items. Use the initWithTitle:image:tag: method to create a custom item with the specified title and image, which is used as both the unselected and selected image. Use the initWithTitle:image:selectedImage: method to create a custom item with the specified title, unselected image, and selected image.

Customizing Appearance

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 UIBarItem. 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, [UITabBarItem appearance]), 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 UIImageRenderingModeAlwaysOriginal.

For more information about appearance and behavior configuration, see Tab Bars.

Topics

Initializing an Item

- initWithTabBarSystemItem:tag:

Creates and returns a new item containing the specified system item.

- initWithTitle:image:tag:

Creates and returns a new item using the specified properties.

- initWithTitle:image:selectedImage:

Creates and returns a new item with the specified title, unselected image, and selected image.

- init

Initializes the tab bar item to its default state.

UITabBarSystemItem

System items that can be used on a tab bar.

Customizing the Item's Appearance

standardAppearance

The appearance settings for this specific tab bar item.

Legacy Customizations

Customize appearance information directly on the tab bar item object.

Managing the Finished Selected Image

- finishedSelectedImage

Returns the finished selected image.

Deprecated
- finishedUnselectedImage

Returns the finished unselected image.

Deprecated
- setFinishedSelectedImage:withFinishedUnselectedImage:

Sets the finished selected and unselected images.

Deprecated

Relationships

Inherits From

See Also

Bars

UIBarItem

An abstract superclass for items that can be added to a bar that appears at the bottom of the screen.

UIBarButtonItem

A button specialized for placement on a toolbar or tab bar.

UIBarButtonItemGroup

A set of bar button items on the shortcuts bar above the keyboard on iPad.

UINavigationBar

Navigational controls displayed in a bar along the top of the screen, usually in conjunction with a navigation controller.

UISearchBar

A specialized view for receiving search-related information from the user.

UIToolbar

A control that displays one or more buttons along the bottom edge of your interface.

UITabBar

A control that displays one or more buttons in a tab bar for selecting between different subtasks, views, or modes in an app.

UIBarPositioning

A set of methods for defining the ways that bars can be positioned in iOS apps.

UIBarPositioningDelegate

A set of methods that support the positioning of a bar that conforms to the UIBarPositioning protocol.