Instance Method

setBadgeTextAttributes(_:for:)

Assigns custom text attributes to the badge text.

Declaration

func setBadgeTextAttributes(_ textAttributes: [NSAttributedString.Key : Any]?, for state: UIControl.State)

Parameters

textAttributes

The attributed string attributes that you want to apply to the badge text. For example, you might specify custom font or color information for your text. For a list of attributes that you can apply, see Character Attributes in NSAttributedString.

state

The state for which to apply the attributes. The possible values are described in UIControl.State.

Discussion

Use this method to apply custom attributes to the text in the badgeValue property. You might apply custom attributes so that your badge text matches the appearance of the item text.

See Also

Configuring the Badge

var badgeValue: String?

Text that is displayed in the upper-right corner of the item with a surrounding red oval.

var badgeColor: UIColor?

The background color to apply to the badge.

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

Retrieves the custom text attributes associated with the item's badge text.