---
title: "setBackgroundImage(_:forToolbarPosition:barMetrics:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitoolbar/setbackgroundimage(_:fortoolbarposition:barmetrics:)"
---

# setBackgroundImage(_:forToolbarPosition:barMetrics:)

Sets the image to use for the background in a given position and with given metrics.

## Declaration

```swift
func setBackgroundImage(_ backgroundImage: UIImage?, forToolbarPosition topOrBottom: UIBarPosition, barMetrics: UIBarMetrics)
```

## Parameters

- `backgroundImage`: The image to use for the toolbar background in the position specified by topOrBottom and with the metrics specified by barMetrics.
- `topOrBottom`: A toolbar position constant.
- `barMetrics`: A bar metrics constant.

## See Also

### Changing the background

- [barTintColor](uikit/uitoolbar/bartintcolor.md)
- [backgroundImage(forToolbarPosition:barMetrics:)](uikit/uitoolbar/backgroundimage(fortoolbarposition:barmetrics:).md)
