iOS Reference Library Apple Developer
Search

UIToolbar Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/UIKit.framework
Availability
Available in iOS 2.0 and later.
Declared in
UIToolbar.h
Related sample code

Overview

An instance of the UIToolbar class is a control for selecting one of many buttons, called toolbar items. A toolbar momentarily highlights or does not change the appearance of an item when tapped. Use the UITabBar class if you need a radio button style control.

Use the UIBarButtonItem class to create items and the setItems:animated: method to add them to a toolbar. All methods with an animated: argument allow you to optionally animate changes to the display.

Toolbar images that represent normal and highlighted states of an item derive from the image you set using the inherited image property from the UIBarItem class. For example, the image is converted to white and then bevelled by adding a shadow for the normal state.

Tasks

Configuring the Toolbar

Configuring Toolbar Items

Properties

For more about Objective-C properties, see “Properties” in The Objective-C Programming Language.

barStyle

The toolbar style that specifies its appearance.

@property(nonatomic) UIBarStyle barStyle

Discussion

See UIBarStyle for possible values. The default value is UIBarStyleDefault.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIToolbar.h

items

The items displayed on the toolbar.

@property(nonatomic, copy) NSArray *items

Discussion

The items, instances of UIBarButtonItem, that are visible on the toolbar in the order they appear in this array. Any changes to this property are not animated. Use the setItems:animated: method to animate changes.

The default value is nil.

Availability
  • Available in iOS 2.0 and later.
Related Sample Code
Declared In
UIToolbar.h

tintColor

The color used to tint the bar.

@property(nonatomic, retain) UIColor *tintColor

Discussion

The default value is nil.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIToolbar.h

translucent

A Boolean value that indicates whether the toolbar is translulcent (YES) or not (NO).

@property(nonatomic,assign,getter=isTranslucent) BOOL translucent

Discussion

Applying translucence to a toolbar is intended primarily for landscape orientation, when you want the user to be able to view the area beneath the toolbar. The default value for this property is NO. However, if you set the toolbar style to UIBarStyleBlackTranslucent, the value for this property is always YES.

Availability
  • Available in iOS 3.0 and later.
Declared In
UIToolbar.h

Instance Methods

setItems:animated:

Sets the items on the toolbar by animating the changes.

- (void)setItems:(NSArray *)items animated:(BOOL)animated

Parameters
items

The items to display on the toolbar.

animated

A Boolean value if set to YES animates the transition to the items; otherwise, does not.

Discussion

If animated is YES, the changes are dissolved or the reordering is animated—for example, removed items fade out and new items fade in. This method also adjusts the spacing between items.

Availability
  • Available in iOS 2.0 and later.
Declared In
UIToolbar.h



Last updated: 2009-03-09

Did this document help you? Yes It's good, but... Not helpful...