Class

UIBarItem

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

Declaration

@interface UIBarItem : NSObject

Overview

Items on a bar behave in a way similar to buttons (instances of UIButton). They have a title, image, action, and target. You can also enable and disable an item on a bar.

Customizing Appearance

You can customize the image to represent the item, and the position of the image, using image and imageInsets respectively.

In iOS v5.0 and later, you can also specify a custom image and position to use in landscape orientation when using the iPhone appearance idiom using landscapeImagePhone and landscapeImagePhoneInsets respectively. In addition, you can customize the title’s text attributes using setTitleTextAttributes:forState:, either for a single item, or for all items by using the appearance proxy (for example, [UIBarItem appearance]).

Topics

Initializing a Bar Item

- init

Initializes the bar item to its default state.

Getting and Setting Properties

title

The title displayed on the item.

image

The image used to represent the item.

landscapeImagePhone

The image to use to represent the item in landscape orientation when using the iPhone appearance idiom.

largeContentSizeImage

The image to display for users with visual impairments.

imageInsets

The image inset or outset for each edge.

landscapeImagePhoneInsets

The image inset or outset for each edge of the image in landscape orientation when using the iPhone appearance idiom.

largeContentSizeImageInsets

The insets to apply to the bar item's large image when displaying the image in an assistive UI.

enabled

A Boolean value indicating whether the item is enabled.

tag

The receiver’s tag, an application-supplied integer that you can use to identify bar item objects in your application.

Customizing Appearance

- setTitleTextAttributes:forState:

Sets the title’s text attributes for a given control state.

- titleTextAttributesForState:

Returns the title’s text attributes for a given control state.

Relationships

Inherits From

Conforms To

See Also

Bars

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.

UITabBarItem

An item in a tab bar.

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.