---
title: "backgroundImage(for:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uinavigationbar/backgroundimage(for:)"
---

# backgroundImage(for:)

Returns the background image for given bar metrics.

## Declaration

```swift
func backgroundImage(for barMetrics: UIBarMetrics) -> UIImage?
```

## Parameters

- `barMetrics`: A bar metrics constant.

## Return Value

Return Value The background image for barMetrics.

## Discussion

Discussion Equivalent to using backgroundImage(for:barMetrics:) with a position of UIBarPosition.any.

## See Also

### Changing the background

- [barTintColor](uikit/uinavigationbar/bartintcolor.md)
- [setBackgroundImage(_:for:)](uikit/uinavigationbar/setbackgroundimage(_:for:).md)
- [backgroundImage(for:barMetrics:)](uikit/uinavigationbar/backgroundimage(for:barmetrics:).md)
- [setBackgroundImage(_:for:barMetrics:)](uikit/uinavigationbar/setbackgroundimage(_:for:barmetrics:).md)
