---
title: "setBackgroundImage(_:for:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uibutton/setbackgroundimage(_:for:)"
---

# setBackgroundImage(_:for:)

Sets the background image to use for the specified button state.

## Declaration

```swift
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 doc://com.apple.uikit/documentation/UIKit/UIControl/State-swift.struct.

## Discussion

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.

## See Also

### Managing images and tint color

- [backgroundImage(for:)](uikit/uibutton/backgroundimage(for:).md)
- [image(for:)](uikit/uibutton/image(for:).md)
- [setImage(_:for:)](uikit/uibutton/setimage(_:for:).md)
- [preferredSymbolConfigurationForImage(in:)](uikit/uibutton/preferredsymbolconfigurationforimage(in:).md)
- [setPreferredSymbolConfiguration(_:forImageIn:)](uikit/uibutton/setpreferredsymbolconfiguration(_:forimagein:).md)
- [tintColor](uikit/uibutton/tintcolor.md)
