setAttributedText(_:)
Sets the label text to the specified attributed string.
Declaration
func setAttributedText(_ attributedText: NSAttributedString?)Parameters
- attributedText:
The formatted text string to be displayed in the label. Specifying
nilclears the current text from the label.
Mentioned in
Discussion
This method changes the label text to the new value, replacing the old text if any. Any font and style attributes applied to the string take precedence over default values. If you do not explicitly specify font or styling information, the default values are used instead. For example, if you do not specify a text color explicitly, the default text color is used.
Attributed strings may not contain any NSTextAttachment objects as part of their content.