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

# setScopeBarButtonBackgroundImage(_:for:)

Sets the background image for the scope bar button in a given state.

```
func setScopeBarButtonBackgroundImage(_ backgroundImage: UIImage?, for state: UIControl.State)
```

## Parameters

`backgroundImage`

The background image for the scope bar button in `state`.

`state`

A control state.

## Discussion

For more details, see [`scopeBarButtonBackgroundImage(for:)`](/documentation/UIKit/UISearchBar/scopeBarButtonBackgroundImage(for:)).

---

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)