<!--
{
  "availability" : [
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WatchKit",
  "identifier" : "/documentation/WatchKit/WKInterfaceButton/setAttributedTitle(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WatchKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKInterfaceButton(im)setAttributedTitle:"
  },
  "title" : "setAttributedTitle(_:)"
}
-->

# setAttributedTitle(_:)

Sets the button title to the specified attributed string.

```
func setAttributedTitle(_ attributedTitle: NSAttributedString?)
```

## Parameters

`attributedTitle`

The formatted text string to be displayed in the button. Specifying `nil` clears the current text from the button.

## Discussion

This method sets the content of the button to the specified text, replacing the previous text. The text is drawn using the style information in `attributedTitle`. If the button has a background image, the text is drawn on top of that image.

If you use styled text in your buttons, you must provide localized versions of the text yourself. Attributed strings may not contain any NSTextAttachment objects as part of their content.

---

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)