Instance Method

setBackgroundImage(_:for:style:barMetrics:)

Sets the background image for the specified state, style, and metrics.

Declaration

func setBackgroundImage(_ backgroundImage: UIImage?, for state: UIControl.State, style: UIBarButtonItem.Style, barMetrics: UIBarMetrics)

Parameters

backgroundImage

The background image to use for the specified state, style, and metrics.

state

The bar button state.

style

The bar button style.

barMetrics

The bar button metrics.

Discussion

For good results, backgroundImage must be a stretchable image.

See Also

Customizing Appearance

var tintColor: UIColor?

The tint color to apply to the button item.

func backButtonBackgroundImage(for: UIControl.State, barMetrics: UIBarMetrics) -> UIImage?

Returns the back button background image for a given control state and bar metrics.

func setBackButtonBackgroundImage(UIImage?, for: UIControl.State, barMetrics: UIBarMetrics)

Sets the back button background image for a given control state and bar metrics

func backButtonTitlePositionAdjustment(for: UIBarMetrics) -> UIOffset

Returns the back button title offset for given bar metrics.

func setBackButtonTitlePositionAdjustment(UIOffset, for: UIBarMetrics)

Sets the back button title offset for given bar metrics

func backButtonBackgroundVerticalPositionAdjustment(for: UIBarMetrics) -> CGFloat

Returns the back button vertical position offset for given bar metrics.

func setBackButtonBackgroundVerticalPositionAdjustment(CGFloat, for: UIBarMetrics)

Sets the back button vertical position offset for given bar metrics.

func backgroundVerticalPositionAdjustment(for: UIBarMetrics) -> CGFloat

Returns the background vertical position offset for given bar metrics.

func setBackgroundVerticalPositionAdjustment(CGFloat, for: UIBarMetrics)

Sets the background vertical position offset for given bar metrics.

func backgroundImage(for: UIControl.State, barMetrics: UIBarMetrics) -> UIImage?

Returns the background image for a given state and bar metrics.

func setBackgroundImage(UIImage?, for: UIControl.State, barMetrics: UIBarMetrics)

Sets the background image for a given state and bar metrics.

func titlePositionAdjustment(for: UIBarMetrics) -> UIOffset

Returns the title offset for given bar metrics.

func setTitlePositionAdjustment(UIOffset, for: UIBarMetrics)

Sets the title offset for given bar metrics.