A set of bar button items on the shortcuts bar above the keyboard on iPad.
SDKs
- iOS 9.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- UIKit
Declaration
@interface 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 UIText
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.