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


Bars can be positioned at the bottom of their enclosing view, at the top of their enclosing view, or at both the top of their enclosing view and also the top of the screen. In this last case, the bar will abut the status bar displayed by the system. Bars in this position need to have their background extend above their own frame to the top of the screen. This allows the background to show through the status bar.

The classes that implement bars have paired methods to set a background for a given position and set of metrics. These are named similar to the following: backgroundImage(for:barMetrics:) and setBackgroundImage(_:for:barMetrics:). Use these methods to set an appropriate background image for the different possible bar positions and metrics.


Accessing the Bar Position

var barPosition: UIBarPosition

The position of the bar.



enum UIBarMetrics

Constants to specify metrics to use for appearance.

enum UIBarPosition

Constants to identify the position of a bar.


Inherits From

See Also


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 UIBarButtonItemGroup

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

class UINavigationBar

A control that supports navigation of hierarchical content, most often used in navigation controllers.

class UISearchBar

A text field–like control that supports text-based searches.

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 UIBarPositioningDelegate

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