Contents

setBackgroundImage(_:for:)

Sets the background image for the control when it’s in the specified state.

Declaration

func setBackgroundImage(_ image: UIImage?, for state: UIControl.State)

Parameters

  • image:

    The background image to use for the specified state.

  • state:

    The control state in which you want to display the image.

Discussion

For good results, image must be a stretchable image.

See Also

Customizing appearance