Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/UIKit.framework |
Availability | Available in iOS 2.0 and later. |
Declared in | UITabBarItem.h |
The UITabBarItem
class implements an item on a tab bar, instances of the UITabBar
class. 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 Phone application 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.
For more about Objective-C properties, see “Properties” in The Objective-C Programming Language.
Text that is displayed in the upper-right corner of the item with a surrounding red oval.
@property(nonatomic, copy) NSString *badgeValue
The default value is nil
.
UITabBarItem.h
Creates and returns a new item containing the specified system item.
- (id)initWithTabBarSystemItem:(UITabBarSystemItem)systemItem tag:(NSInteger)tag
The system item to use as the first item on the tab bar. One of the constants defined in UITabBarSystemItem
.
The receiver’s tag, an integer that you can use to identify bar item objects in your application.
A newly initialized item containing the specified system item. The item’s target is nil
.
This method returns a system-supplied tab bar item. The title and image properties of the returned item cannot be changed later.
UITabBarItem.h
Creates and returns a new item using the specified properties.
- (id)initWithTitle:(NSString *)title image:(UIImage *)image tag:(NSInteger)tag
The item’s title. If nil
, a title is not displayed.
The item’s image. If nil
, an image is not displayed.
The images displayed on the tab bar are derived from this image. If this image is too large to fit on the tab bar, it is scaled to fit. The size of an tab bar image is typically 30 x 30 points. The alpha values in the source image are used to create the unselected and selected images—opaque values are ignored.
The receiver’s tag, an integer that you can use to identify bar item objects in your application.
Newly initialized item with the specified properties.
UITabBarItem.h
System items that can be used on a tab bar.
typedef enum { UITabBarSystemItemMore, UITabBarSystemItemFavorites, UITabBarSystemItemFeatured, UITabBarSystemItemTopRated, UITabBarSystemItemRecents, UITabBarSystemItemContacts, UITabBarSystemItemHistory, UITabBarSystemItemBookmarks, UITabBarSystemItemSearch, UITabBarSystemItemDownloads, UITabBarSystemItemMostRecent, UITabBarSystemItemMostViewed, } UITabBarSystemItem;
UITabBarSystemItemMore
The more system item.
Available in iOS 2.0 and later.
Declared in UITabBarItem.h
.
UITabBarSystemItemFavorites
The favorites system item.
Available in iOS 2.0 and later.
Declared in UITabBarItem.h
.
UITabBarSystemItemFeatured
The featured system item.
Available in iOS 2.0 and later.
Declared in UITabBarItem.h
.
UITabBarSystemItemTopRated
The top rated system item.
Available in iOS 2.0 and later.
Declared in UITabBarItem.h
.
UITabBarSystemItemRecents
The recents system item.
Available in iOS 2.0 and later.
Declared in UITabBarItem.h
.
UITabBarSystemItemContacts
The contacts system item.
Available in iOS 2.0 and later.
Declared in UITabBarItem.h
.
UITabBarSystemItemHistory
The history system item.
Available in iOS 2.0 and later.
Declared in UITabBarItem.h
.
UITabBarSystemItemBookmarks
The bookmarks system item.
Available in iOS 2.0 and later.
Declared in UITabBarItem.h
.
UITabBarSystemItemSearch
The search system item.
Available in iOS 2.0 and later.
Declared in UITabBarItem.h
.
UITabBarSystemItemDownloads
The downloads system item.
Available in iOS 2.0 and later.
Declared in UITabBarItem.h
.
UITabBarSystemItemMostRecent
The most recent system item.
Available in iOS 2.0 and later.
Declared in UITabBarItem.h
.
UITabBarSystemItemMostViewed
The most viewed system item.
Available in iOS 2.0 and later.
Declared in UITabBarItem.h
.
The title and image of system tab bar items cannot be changed.
UITabBarItem.h
Last updated: 2009-03-05