<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIToolbar/setBackgroundImage(_:forToolbarPosition:barMetrics:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIToolbar(im)setBackgroundImage:forToolbarPosition:barMetrics:"
  },
  "title" : "setBackgroundImage(_:forToolbarPosition:barMetrics:)"
}
-->

# setBackgroundImage(_:forToolbarPosition:barMetrics:)

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

```
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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)