<!--
{
  "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/setScopeBarButtonTitleTextAttributes(_:for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UISearchBar(im)setScopeBarButtonTitleTextAttributes:forState:"
  },
  "title" : "setScopeBarButtonTitleTextAttributes(_:for:)"
}
-->

# setScopeBarButtonTitleTextAttributes(_:for:)

Sets the text attributes for the search bar’ button’s title string for a given state.

```
func setScopeBarButtonTitleTextAttributes(_ attributes: [NSAttributedString.Key : Any]?, for state: UIControl.State)
```

## Parameters

`attributes`

A dictionary containing key-value pairs specifying the text attributes to use for `state`.

    You may specify the font, text color, text shadow color, and text shadow offset, using the keys found in NSString UIKit Additions Reference.

`state`

A control state.

---

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)