Contents

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 the background