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

# backgroundImage(forToolbarPosition:barMetrics:)

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

## Declaration

```swift
func backgroundImage(forToolbarPosition topOrBottom: UIBarPosition, barMetrics: UIBarMetrics) -> UIImage?
```

## Parameters

- `topOrBottom`: The location the bar is being drawn in.
- `barMetrics`: The metrics being used to draw the bar.

## Return Value

Return Value The image to use for the toolbar background in the position specified by topOrBottom and with the metrics specified by barMetrics.

## Discussion

Discussion The default value is nil. When non-nil the image will be used instead of the system image for toolbars in the specified position.

## See Also

### Changing the background

- [barTintColor](uikit/uitoolbar/bartintcolor.md)
- [setBackgroundImage(_:forToolbarPosition:barMetrics:)](uikit/uitoolbar/setbackgroundimage(_:fortoolbarposition:barmetrics:).md)
