---
title: "setTitleTextAttributes(_:for:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uibaritem/settitletextattributes(_:for:)"
---

# setTitleTextAttributes(_:for:)

Sets the title’s text attributes for a given control state.

## Declaration

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

## Parameters

- `attributes`: A dictionary containing key-value pairs for text attributes. You can specify the font, text color, text shadow color, and text shadow offset using the keys listed in NSString UIKit Additions Reference.
- `state`: The control state for which you want to set the text attributes for the title.

## See Also

### Customizing appearance

- [titleTextAttributes(for:)](uikit/uibaritem/titletextattributes(for:).md)
