A data object containing the specific customizations for a bar button item in a particular state.


class UIBarButtonItemStateAppearance : NSObject


Use a UIBarButtonItemStateAppearance object to customize the title and background image of your bar button items. Don't create UIBarButtonItemStateAppearance objects yourself. Instead, create a UIBarButtonItemAppearance object and use its properties to fetch the appearance attributes for the button in a particular state. For example, to set the button's attributes when it is in the normal state, configure the object in the normal property.


Configuring the Title

var titleTextAttributes: [NSAttributedString.Key : Any]

String attributes to apply to the text of the bar button item's title.

var titlePositionAdjustment: UIOffset

The additional amount by which to offset the title horizontally and vertically.

Configuring the Background Appearance

var backgroundImage: UIImage?

A background image to display around the button

var backgroundImagePositionAdjustment: UIOffset

The distance, in points, by which to offset the background image horizontally and vertically.


Inherits From

Conforms To

See Also

Shared Appearance

class UIBarAppearance

An object for customizing the basic appearance of system bars.

class UIBarButtonItemAppearance

An object for customizing the appearance of bar button items.