Contents

searchBarPlacementBarButtonItem

An item you use to control the placement of the search bar in a toolbar on iPhone.

Declaration

var searchBarPlacementBarButtonItem: UIBarButtonItem { get }

Overview

When searchBarPlacement is .integrated or .integratedButton and a search controller is present, use this bar button item in the view controller’s toolbarItems to control the placement of the search bar among them when the search bar is appearing in the UIToolbar on iPhone. Without this bar button item, the positioning for the search bar defaults to trailingmost for the UIToolbar case.

The system ignores this bar button item during toolbar layout if searchController is nil. UIBarButtonItemGroup throws an invalidArgumentException when you include this bar button item in its initialization. UINavigationItem throws an invalidArgumentException when you include this bar button item in leftBarButtonItems or rightBarButtonItems.

See Also

Integrating search into your interface