UIAccessibility

A set of methods that provide accessibility information about views and controls in an app's user interface.

Overview

The UIAccessibility informal protocol provides accessibility information about an app’s user interface elements. Assistive apps, such as VoiceOver, convey this information to users with disabilities to help them use the app.

Standard UIKit controls and views implement the UIAccessibility methods and are therefore accessible to assistive apps by default. This means that if your app uses only standard controls and views, such as UIButton, UISegmentedControl, and UITableView, you need only supply app-specific details when the default values are incomplete. You can do this by setting these values in Interface Builder or by setting the properties in this informal protocol.

The UIAccessibility informal protocol is also implemented by the UIAccessibilityElement class, which represents custom user interface objects. If you create a completely custom UIView subclass, you might need to create an instance of UIAccessibilityElement to represent it. In this case, you would support all the UIAccessibility properties to correctly set and return the accessibility element’s properties.

Topics

Determining Accessibility

var isAccessibilityElement: Bool

A Boolean value indicating whether the receiver is an accessibility element that an assistive application can access.

Configuring Behavior

Accessibility Traits

Tell an assistive application how an accessibility element behaves or should be treated by setting these accessibility traits

var accessibilityTraits: UIAccessibilityTraits

The combination of accessibility traits that best characterize the accessibility element.

struct UIAccessibilityTraits

A mask that contains the OR combination of the accessibility traits that best characterize an accessibility element.

var accessibilityCustomRotors: [UIAccessibilityCustomRotor]?

An array of custom rotors for the current element.

var accessibilityElementsHidden: Bool

A Boolean value indicating whether the accessibility elements contained within this accessibility element are hidden.

var accessibilityNotifiesWhenDestroyed: Bool

A Boolean value that indicates whether a custom accessibility object sends a notification when its corresponding UI element is destroyed.

var accessibilityRespondsToUserInteraction: Bool

A Boolean value indicating whether the element performs an action based on user interaction.

var accessibilityViewIsModal: Bool

A Boolean value indicating whether VoiceOver should ignore the elements within views that are siblings of the receiver.

var shouldGroupAccessibilityChildren: Bool

A Boolean value indicating whether VoiceOver should group together the elements that are children of the receiver, regardless of their positions on the screen.

Defining Accessibility Text and Language

Speech Attributes for Attributed Strings

Apply attributes to text in an attributed string to modify how that text is pronounced.

Text Attributes for Attributed Strings

Apply attributes to text in an attributed string to convey extra information about the text.

var accessibilityHeaderElements: [Any]?

An array of elements considered to be the headers for this element.

var accessibilityAttributedHint: NSAttributedString?

The underlying attributed version of the accessibility hint.

var accessibilityHint: String?

A brief description of the result of performing an action on the accessibility element, in a localized string.

var accessibilityAttributedLabel: NSAttributedString?

The underlying attributed version of the accessibility label.

var accessibilityLabel: String?

A succinct label that identifies the accessibility element, in a localized string.

var accessibilityLanguage: String?

The language in which to speak the accessibility element's label, value, and hint.

var accessibilityTextualContext: UIAccessibilityTextualContext?

A named context that helps identify and classify the type of text inside an element.

var accessibilityAttributedUserInputLabels: [NSAttributedString]!

The underlying attributed versions of the accessibility user input labels.

var accessibilityUserInputLabels: [String]!

An array of localized labels the user provides to refer to this element.

var accessibilityAttributedValue: NSAttributedString?

The underlying attributed version of the accessibility value.

var accessibilityValue: String?

The value of the accessibility element, in a localized string.

Handling Notifications

Assistive Technology Identifiers

Manage pausing and resuming assistive technologies with these identifiers.

Notification Dictionary Keys

Handle notifications with the keys defined in the userInfo parameter dictionary.

struct UIAccessibility.Notification

A notification that an accessible application can send.

Navigating Elements

UIAccessibilityContainer

Provide a set of methods that view subclasses use to make subcomponents accessible as separate elements.

var accessibilityActivationPoint: CGPoint

The activation point for the accessibility element, in screen coordinates.

var accessibilityFocusedUIElement: Any?

The deepest descendant of the accessibility hierarchy that has the focus.

var accessibilityFrame: CGRect

The frame of the accessibility element, in screen coordinates.

func accessibilityHitTest(NSPoint) -> Any?

Returns the deepest descendant of the accessibility hierarchy that contains the specified point.

var accessibilityNavigationStyle: UIAccessibilityNavigationStyle

The navigation style to apply to the object and its elements.

enum UIAccessibilityNavigationStyle

Constants that describe how an object’s elements should be navigated by an assistive technology.

var accessibilityPath: UIBezierPath?

The path of the element, in screen coordinates.

static func zoomFocusChanged(zoomType: UIAccessibility.ZoomType, toFrame: CGRect, in: UIView)

Notifies the system that the app’s focus has changed to a new location.

enum UIAccessibility.ZoomType

The types of system zoom that can be in effect.

See Also

Essentials

UIAccessibilityContainer

Provide a set of methods that view subclasses use to make subcomponents accessible as separate elements.

Supporting VoiceOver in Your App

Learn how to make your iOS app more accessible to users who are blind or have low vision by adding VoiceOver support.