An object for customizing the basic appearance of system bars.


class UIBarAppearance : NSObject


A UIBarAppearance object contains the common traits shared by navigation bars, tab bars, and toolbars. When configuring a specific type of bar, you usually instantiate the appropriate bar appearance subclass. However, you may also create a UIBarAppearance object, configure its properties, and use it to create new bar appearance objects in your app.


Creating a Custom Bar Appearance

init(idiom: UIUserInterfaceIdiom)

Creates a new bar appearance object that targets the specified idiom.

init(barAppearance: UIBarAppearance)

Creates a new bar appearance object by copying relevant data from the specified appearance object.


Creates a new bar appearance object containing default values.

Resetting the Appearance Properties

func configureWithDefaultBackground()

Configures the bar appearance object with default background and shadow values.

func configureWithOpaqueBackground()

Configures the bar appearance object with a set of opaque colors that are appropriate for the current theme.

func configureWithTransparentBackground()

Configures the bar appearance object with a transparent background and no shadow.

Configuring the Background Appearance

var backgroundEffect: UIBlurEffect?

The blur effect to apply to the bar's background.

var backgroundColor: UIColor?

The background color of the bar.

var backgroundImage: UIImage?

The image to display on top of the bar's background color.

var backgroundImageContentMode: UIView.ContentMode

The content mode to use when displaying the bar's background image.

Configuring the Shadow Appearance

var shadowColor: UIColor?

The color to apply to the bar's custom or default shadow.

var shadowImage: UIImage?

The image to use for the bar's shadow.

Getting the Supported Idiom

var idiom: UIUserInterfaceIdiom

The idiom targeted by this bar appearance object.

Instance Methods


Inherits From

See Also

Shared Appearance

class UIBarButtonItemAppearance

An object for customizing the appearance of bar button items.

class UIBarButtonItemStateAppearance

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