Contents

setAccessibilityLabel(_:)

Sets a succinct label on the object that identifies the accessibility element.

Declaration

func setAccessibilityLabel(_ accessibilityLabel: String?)

Parameters

  • accessibilityLabel:

    A localized string for identifying the object to the accessibility system. The string you specify should succinctly describe the purpose of the object.

Discussion

Use this method to change the accessibility label of an object dynamically. You can also set the accessibility label for an object in Xcode from the Identity inspector. If you do not set an accessibility label, the system uses the object’s title string, if present.

An assistive application uses this label to identify the item to a user with disabilities. For example, if a button uses an image to convey its meaning to sighted users, you can assign a label that describes the behavior of the button to users with disabilities.

See Also

Configuring the Accessibility Attributes