Instance Method


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


func titleTextAttributes(for state: UIControl.State) -> [NSAttributedString.Key : Any]?



The control state for which you want to know the text attributes for the title.

Return Value

The title’s text attributes for state.


The dictionary may contain key-value pairs for text attributes for the font, text color, text shadow color, and text shadow offset using the keys listed in NSString UIKit Additions Reference.

See Also

Customizing Appearance

func setTitleTextAttributes([NSAttributedString.Key : Any]?, for: UIControl.State)

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software