Legacy Customizations

Customize appearance information directly on the toolbar object.

Overview

In iOS 13 and later, customize your toolbar using the standardAppearance and compactAppearance properties. You may continue to use these legacy accessors to customize your toolbar's appearance directly, but you must update the appearance for different bar configurations yourself.

Topics

Setting the Bar's Style

var barStyle: UIBarStyle

The toolbar style that specifies its appearance.

enum UIBarStyle

Defines the stylistic appearance of different types of views.

Configuring Bar Button Items

var tintColor: UIColor!

The tint color to apply to the bar button items.

Changing the Background

var barTintColor: UIColor?

The tint color to apply to the toolbar background.

func backgroundImage(forToolbarPosition: UIBarPosition, barMetrics: UIBarMetrics) -> UIImage?

Returns the image to use for the background in a given position and with given metrics.

func setBackgroundImage(UIImage?, forToolbarPosition: UIBarPosition, barMetrics: UIBarMetrics)

Sets the image to use for the background in a given position and with given metrics.

Adding a Shadow

func shadowImage(forToolbarPosition: UIBarPosition) -> UIImage?

Returns the image to use for the toolbar shadow in a given position.

func setShadowImage(UIImage?, forToolbarPosition: UIBarPosition)

Sets the image to use for the toolbar shadow in a given position.

See Also

Customizing Appearance

var standardAppearance: UIToolbarAppearance

The appearance settings to use for a standard-height toolbar.

var compactAppearance: UIToolbarAppearance?

The appearance settings to use for a compact-height toolbar.

var isTranslucent: Bool

A Boolean value that indicates whether the toolbar is translucent (true) or not (false).