Class

UIBarButtonItemGroup

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

Declaration

class UIBarButtonItemGroup : NSObject

Overview

A group contains one or more bar button items and an optional representative item that is displayed instead of the individual items when space is constrained. You can create any number of groups and configure each group with any number of items.

When creating a group with more than one bar button item, it is recommended that you also provide a representative item to display. The representative item must be a completely separate bar button item; it must not be one of the items already in the group. UIKit displays the representative item when there is not enough room to display all of the group’s items in the shortcuts bar. Taps in the representative item call that item’s action method. When you do not specify an action method, UIKit automatically displays the items in the group using a standard interface. To present your own interface, provide a custom action method and use it to display the interface you want.

After configuring a group, assign it to the UITextInputAssistantItem object associated with one of your app’s responder objects. Your custom items are displayed only in conjunction with the system keyboard. When the keyboard is displayed, UIKit retrieves your custom groups from the text input assistant item and adds the corresponding items to the shortcuts bar. You may specify more than one group before and after the typing suggestions. UIKit tries to display as many items as possible on the shortcuts bar, falling back to the groups’ representative items as needed.

Topics

Initializing a Bar Button Item Group

init(barButtonItems: [UIBarButtonItem], representativeItem: UIBarButtonItem?)

Initializes and returns a bar button item group with the specified items.

Configuring the Group

var barButtonItems: [UIBarButtonItem]

The bar button items to display on the shortcuts bar.

var representativeItem: UIBarButtonItem?

The item to display for a group when space is constrained.

Determining the Group’s Appearance

var isDisplayingRepresentativeItem: Bool

A Boolean value indicating whether the representative item is being displayed in place of the group’s items.

Relationships

Inherits From

See Also

Bars

class UIBarItem

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

class UIBarButtonItem

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

class UINavigationBar

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

class UISearchBar

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

class UIToolbar

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

class UITabBar

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

class UITabBarItem

An item in a tab bar.

protocol UIBarPositioning

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

protocol UIBarPositioningDelegate

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software