setBackgroundImage(_:for:)
Sets the background image to use for the specified button state.
Declaration
func setBackgroundImage(_ image: UIImage?, for state: UIControl.State)Parameters
- image:
The background image to use for the specified state.
- state:
The state that uses the specified image. The values are described in State Swift.struct.
Discussion
In general, if a property is not specified for a state, the default is to use the normal value. If the normal value is not set, then the property defaults to a system value. Therefore, at a minimum, you should set the value for the normal state.