iOS Developer Library

Developer

UIKit Framework Reference UIAccessibility Protocol Reference

Options
Deployment Target:

On This Page
Language:

UIAccessibility

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

Standard UIKit controls and views implement the UIAccessibility methods and are therefore accessible to assistive applications by default. This means that if your application uses only standard controls and views, such as UIButton, UISegmentedControl, and UITableView, you need only supply application-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.

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import UIKit

Objective-C

@import UIKit;

Availability


Available in iOS 3.0 and later.
  • A Boolean value indicating whether the receiver is an accessibility element that an assistive application can access.

    Declaration

    Swift

    var isAccessibilityElement: Bool

    Objective-C

    @property(nonatomic) BOOL isAccessibilityElement

    Discussion

    The default value for this property is NOfalse unless the receiver is a standard UIKit control, in which case the value is YEStrue.

    Assistive applications can get only information about objects that are represented by accessibility elements. Therefore, if you implement a custom control or view that should be accessible to users with disabilities, you should set this property to YEStrue. The only exception to this practice is a view that merely serves as a container for other items that should be accessible. Such a view should implement the UIAccessibilityContainer protocol and set this property to NOfalse.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later.

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

    Declaration

    Swift

    var accessibilityActivationPoint: CGPoint

    Objective-C

    @property(nonatomic) CGPoint accessibilityActivationPoint

    Discussion

    The default value for this property is the midpoint of the accessibility element’s frame, which is given by accessibilityFrame. The activation point for an element is the specific area VoiceOver activates when a user double-taps the element.

    The ability to specify an activation point allows an element to present to VoiceOver different points in different circumstances without changing how the element presents itself. For example, the standard activation point for a Home screen app icon is the midpoint of the icon. But when the user is rearranging icons on the Home screen, the activation point changes to the midpoint of the remove control (that is, to the circled X in the upper-left corner of the icon).

    You can also use this property to ensure that the activation point for a small element remains accurate even if you present a larger version of the element to VoiceOver.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 5.0 and later.

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

    Declaration

    Swift

    var accessibilityElementsHidden: Bool

    Objective-C

    @property(nonatomic) BOOL accessibilityElementsHidden

    Discussion

    The default value for this property is NOfalse. You might use this property to hide views that are covered by the arrival of a new view. In this case, the hidden views might remain visible onscreen, but they are not the focus of the user’s actions.

    You might also use this property to hide a transient view that VoiceOver users don’t need to notice. For example, VoiceOver doesn’t need to describe the translucent view that appears when users adjust the volume on their devices, because the aural feedback of this action is sufficient.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 5.0 and later.

  • The frame of the accessibility element, in screen coordinates.

    Declaration

    Swift

    var accessibilityFrame: CGRect

    Objective-C

    @property(nonatomic) CGRect accessibilityFrame

    Discussion

    The default value for this property is CGRectZero unless the receiver is a UIView object or is a subclass of UIView, in which case the value is the frame of the view.

    You must set this property for an accessibility element that represents an object that is not a subclass of UIView, because the screen coordinates of such an object are not already known. (You do not have to set this property for an accessibility element that represents a subclass of UIView, because such an object’s screen coordinates are already known.)

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later.

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

    Declaration

    Swift

    var accessibilityHint: String!

    Objective-C

    @property(nonatomic, copy) NSString *accessibilityHint

    Discussion

    The default value for this property is nil unless the receiver is a UIKit control, in which case the value is a system-provided hint based on the type of control.

    An accessibility hint helps users understand what will happen when they perform an action on the accessibility element when that result is not obvious from the accessibility label. For example, if you provide an Add button in your application, the button’s accessibility label helps users understand that tapping the button adds values in the application. If, on the other hand, your application allows users to play a song by tapping its title in a list of song titles, the accessibility label for the list row does not tell users this. To help an assistive application provide this information to users with disabilities, an appropriate hint for the list row would be “Plays the song.”

    Follow these guidelines to create a hint for an accessibility element:

    • The hint should be a very brief phrase that begins with a verb that names the results of the action, such as “Plays the song” or “Purchases the item.”

      Avoid beginning the phrase with the imperative form of a verb, because this can make the hint sound like a command. For example, do not create a hint such as “Play the song” or “Purchase the item.”

    • Don’t repeat the action type in the hint. For example, do not create hints such as “Tap to play the song” or “Tapping plays the song.”

    • Don’t repeat the control or view type in the hint. For example, do not create hints such as “Plays the song in the row” or “Button that adds a contact name.”

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later.

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

    Declaration

    Swift

    var accessibilityLabel: String!

    Objective-C

    @property(nonatomic, copy) NSString *accessibilityLabel

    Discussion

    The default value for this property is nil unless the receiver is a UIKit control, in which case the value is a label derived from the control’s title.

    If you implement a custom control or view, or if you display a custom icon on a UIKit control, you should set this property to make sure your accessibility elements have appropriate labels. If an accessibility element does not display a descriptive label, set this property to supply a short, localized label that succinctly identifies the element. For example, a “Play music” button might display an icon that shows sighted users what it does. To be accessible, however, the button should have the accessibility label “Play” or “Play music” so that an assistive application can provide this information to users with disabilities. Note, however, that the label should never include the control type (such as “button”) because this information is contained in the traits associated with the accessibility element.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later.

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

    Declaration

    Swift

    var accessibilityLanguage: String!

    Objective-C

    @property(nonatomic, retain) NSString *accessibilityLanguage

    Discussion

    The default value for this property is nil. If no language is set, the user’s current language setting is used.

    If you need to set this property, be sure to use a language ID tag that follows the format defined in the BCP 47 specification. A draft of this specification is available at http://www.rfc-editor.org/.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 4.0 and later.

  • The path of the element, in screen coordinates.

    Declaration

    Swift

    @NSCopying var accessibilityPath: UIBezierPath!

    Objective-C

    @property(nonatomic, copy) UIBezierPath *accessibilityPath

    Discussion

    The default value of this property is nil. If no path is set, the accessibility frame rectangle is used to highlight the element.

    When you specify a value for this property, the assistive technology uses the path object you specify (instead of the accessibility frame) to highlight the element.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 7.0 and later.

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

    Declaration

    Swift

    var accessibilityTraits: UIAccessibilityTraits

    Objective-C

    @property(nonatomic) UIAccessibilityTraits accessibilityTraits

    Discussion

    The default value for this property is UIAccessibilityTraitNone unless the receiver is a UIKit control, in which case the value is the standard set of traits associated with the control.

    If you implement a custom control or view, you need to select all the accessibility traits that best characterize the object and combine them with its superclass’s traits (in other words, with super.accessibilityTraits) by performing an OR operation. See Accessibility Traits for a complete list of traits.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later.

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

    Declaration

    Swift

    var accessibilityValue: String!

    Objective-C

    @property(nonatomic, copy) NSString *accessibilityValue

    Discussion

    The default value for this property is nil unless the receiver is a UIKit control, in which case value of the property represents the value of the control, when it differs from the label.

    When an accessibility element has a static label, and a dynamic value, you should set this property to return the value. For example, although an accessibility element that represents a text field might have the label “Message,” its value is the text currently inside the text field.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later.

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

    Declaration

    Swift

    var accessibilityViewIsModal: Bool

    Objective-C

    @property(nonatomic) BOOL accessibilityViewIsModal

    Discussion

    The default value for this property is NOfalse. When the value of this property is YEStrue, VoiceOver ignores the elements within the sibling views of the receiving view.

    For example, in a window that contains sibling views A and B, setting accessibilityViewIsModal to YEStrue on view B causes VoiceOver to ignore the elements in the view A. On the other hand, if view B contains a child view C and you set accessibilityViewIsModal to YEStrue on view C, VoiceOver does not ignore the elements in view A.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 5.0 and later.

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

    Declaration

    Swift

    var shouldGroupAccessibilityChildren: Bool

    Objective-C

    @property(nonatomic) BOOL shouldGroupAccessibilityChildren

    Discussion

    The default value for this property is NOfalse.

    For example, consider an app that shows items in vertical columns. Normally, VoiceOver would navigate through these items in horizontal rows. Setting the value of this property to YEStrue on the parent view of the items in the vertical columns causes VoiceOver to respect the app’s grouping and navigate them correctly.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.

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

    Declaration

    Swift

    var accessibilityNavigationStyle: UIAccessibilityNavigationStyle

    Objective-C

    @property(nonatomic) UIAccessibilityNavigationStyle accessibilityNavigationStyle

    Discussion

    Some assistive technologies let the user select a parent view or container in order to navigate its elements. This property controls whether that behavior applies to the current object. Switch Control uses this technology but VoiceOver and other assistive technologies do not.

    The default value of this property is UIAccessibilityNavigationStyleAutomatic.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 8.0 and later.

Data Types

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

    Declaration

    Swift

    typealias UIAccessibilityTraits = UInt64

    Objective-C

    typedef uint64_t UIAccessibilityTraits;

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later.

  • The types of system Zoom that can be in effect.

    Declaration

    Swift

    enum UIAccessibilityZoomType : Int { case InsertionPoint }

    Objective-C

    typedef enum { UIAccessibilityZoomTypeInsertionPoint, } UIAccessibilityZoomType;

    Constants

    • InsertionPoint

      UIAccessibilityZoomTypeInsertionPoint

      The system zoom type is the text insertion point.

      Available in iOS 5.0 and later.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 5.0 and later.

  • A notification that an accessible application can send.

    Declaration

    Swift

    typealias UIAccessibilityNotifications = UInt32

    Objective-C

    typedef uint32_t UIAccessibilityNotifications;

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later.

  • Accessibility traits that tell an assistive application how an accessibility element behaves or should be treated.

    Declaration

    Swift

    var UIAccessibilityTraitNone: UIAccessibilityTraits var UIAccessibilityTraitButton: UIAccessibilityTraits var UIAccessibilityTraitLink: UIAccessibilityTraits var UIAccessibilityTraitSearchField: UIAccessibilityTraits var UIAccessibilityTraitImage: UIAccessibilityTraits var UIAccessibilityTraitSelected: UIAccessibilityTraits var UIAccessibilityTraitPlaysSound: UIAccessibilityTraits var UIAccessibilityTraitKeyboardKey: UIAccessibilityTraits var UIAccessibilityTraitStaticText: UIAccessibilityTraits var UIAccessibilityTraitSummaryElement: UIAccessibilityTraits var UIAccessibilityTraitNotEnabled: UIAccessibilityTraits var UIAccessibilityTraitUpdatesFrequently: UIAccessibilityTraits var UIAccessibilityTraitStartsMediaSession: UIAccessibilityTraits var UIAccessibilityTraitAdjustable: UIAccessibilityTraits var UIAccessibilityTraitAllowsDirectInteraction: UIAccessibilityTraits var UIAccessibilityTraitCausesPageTurn: UIAccessibilityTraits var UIAccessibilityTraitHeader: UIAccessibilityTraits

    Objective-C

    UIAccessibilityTraits UIAccessibilityTraitNone; UIAccessibilityTraits UIAccessibilityTraitButton; UIAccessibilityTraits UIAccessibilityTraitLink; UIAccessibilityTraits UIAccessibilityTraitSearchField; UIAccessibilityTraits UIAccessibilityTraitImage; UIAccessibilityTraits UIAccessibilityTraitSelected; UIAccessibilityTraits UIAccessibilityTraitPlaysSound; UIAccessibilityTraits UIAccessibilityTraitKeyboardKey; UIAccessibilityTraits UIAccessibilityTraitStaticText; UIAccessibilityTraits UIAccessibilityTraitSummaryElement; UIAccessibilityTraits UIAccessibilityTraitNotEnabled; UIAccessibilityTraits UIAccessibilityTraitUpdatesFrequently; UIAccessibilityTraits UIAccessibilityTraitStartsMediaSession; UIAccessibilityTraits UIAccessibilityTraitAdjustable; UIAccessibilityTraits UIAccessibilityTraitAllowsDirectInteraction; UIAccessibilityTraits UIAccessibilityTraitCausesPageTurn; UIAccessibilityTraits UIAccessibilityTraitHeader;

    Constants

    • UIAccessibilityTraitNone

      UIAccessibilityTraitNone

      The accessibility element has no traits.

      Available in iOS 3.0 and later.

    • UIAccessibilityTraitButton

      UIAccessibilityTraitButton

      The accessibility element should be treated as a button.

      Available in iOS 3.0 and later.

    • UIAccessibilityTraitLink

      UIAccessibilityTraitLink

      The accessibility element should be treated as a link.

      Available in iOS 3.0 and later.

    • UIAccessibilityTraitSearchField

      UIAccessibilityTraitSearchField

      The accessibility element should be treated as a search field.

      Available in iOS 3.0 and later.

    • UIAccessibilityTraitImage

      UIAccessibilityTraitImage

      The accessibility element should be treated as an image.

      This trait can be combined with the button or link traits.

      Available in iOS 3.0 and later.

    • UIAccessibilityTraitSelected

      UIAccessibilityTraitSelected

      The accessibility element is currently selected.

      You can use this trait to characterize an accessibility element that represents, for example, a selected table row or a selected segment in a segmented control.

      Available in iOS 3.0 and later.

    • UIAccessibilityTraitPlaysSound

      UIAccessibilityTraitPlaysSound

      The accessibility element plays its own sound when activated.

      Available in iOS 3.0 and later.

    • UIAccessibilityTraitKeyboardKey

      UIAccessibilityTraitKeyboardKey

      The accessibility element behaves as a keyboard key.

      Available in iOS 3.0 and later.

    • UIAccessibilityTraitStaticText

      UIAccessibilityTraitStaticText

      The accessibility element should be treated as static text that cannot change.

      Available in iOS 3.0 and later.

    • UIAccessibilityTraitSummaryElement

      UIAccessibilityTraitSummaryElement

      The accessibility element provides summary information when the application starts.

      You can use this trait to characterize an accessibility element that provides a summary of current conditions, settings, or state, such as the current temperature in the Weather application.

      Available in iOS 3.0 and later.

    • UIAccessibilityTraitNotEnabled

      UIAccessibilityTraitNotEnabled

      The accessibility element is not enabled and does not respond to user interaction.

      Available in iOS 3.0 and later.

    • UIAccessibilityTraitUpdatesFrequently

      UIAccessibilityTraitUpdatesFrequently

      The accessibility element frequently updates its label or value.

      You can use this trait to characterize an accessibility element that updates its label or value too often to send update notifications. Include this trait when you want an assistive application to avoid handling continual notifications and, instead, poll for changes when it needs updated information. For example, you might use this trait to characterize the readout of a stopwatch.

      Available in iOS 3.0 and later.

    • UIAccessibilityTraitStartsMediaSession

      UIAccessibilityTraitStartsMediaSession

      The accessibility element starts a media session when it is activated.

      You can use this trait to silence the audio output of an assistive technology, such as VoiceOver, during a media session that should not be interrupted. For example, you might use this trait to silence VoiceOver speech while the user is recording audio.

      Available in iOS 4.0 and later.

    • UIAccessibilityTraitAdjustable

      UIAccessibilityTraitAdjustable

      The accessibility element allows continuous adjustment through a range of values.

      You can use this trait to characterize an accessibility element that users can adjust in a continuous manner, such as a slider or a picker view. If you specify this trait on an accessibility element, you must also implement the accessibilityIncrement and accessibilityDecrement methods in the UIAccessibilityAction protocol.

      Available in iOS 4.0 and later.

    • UIAccessibilityTraitAllowsDirectInteraction

      UIAccessibilityTraitAllowsDirectInteraction

      The accessibility element allows direct touch interaction for VoiceOver users.

      You can use this trait to characterize an accessibility element that represents an object that users interact with directly, such as a view that represents a piano keyboard.

      Available in iOS 5.0 and later.

    • UIAccessibilityTraitCausesPageTurn

      UIAccessibilityTraitCausesPageTurn

      The accessibility element should cause an automatic page turn when VoiceOver finishes reading the text within it.

      You can use this trait to characterize an accessibility element that represents a page of content within a set of pages, such as view that represents a page in a book. When VoiceOver finishes reading the content in the current page, it calls accessibilityScroll with UIAccessibilityScrollDirectionNext to scroll to the next content page. If VoiceOver detects that the new content does not differ from the previous content, it stops scrolling.

      Available in iOS 5.0 and later.

    • UIAccessibilityTraitHeader

      UIAccessibilityTraitHeader

      The accessibility element is a header that divides content into sections, such as the title of a navigation bar.

      Available in iOS 6.0 and later.

  • Keys used in the userInfo parameter dictionary of notifications.

    Declaration

    Swift

    let UIAccessibilityAnnouncementKeyStringValue: NSString! let UIAccessibilityAnnouncementKeyWasSuccessful: NSString!

    Objective-C

    NSString *const UIAccessibilityAnnouncementKeyStringValue; NSString *const UIAccessibilityAnnouncementKeyWasSuccessful;

    Constants

    • UIAccessibilityAnnouncementKeyStringValue

      UIAccessibilityAnnouncementKeyStringValue

      The text of the announcement that finished.

      Available in iOS 6.0 and later.

    • UIAccessibilityAnnouncementKeyWasSuccessful

      UIAccessibilityAnnouncementKeyWasSuccessful

      Indicates whether the announcement was successfully made.

      The value of this key is an NSNumber object that you should interpret as a Boolean value.

      Available in iOS 6.0 and later.

  • Attributes that you can apply to text in an attributed string to modify how that text is pronounced.

    Declaration

    Swift

    let UIAccessibilitySpeechAttributePunctuation: NSString! let UIAccessibilitySpeechAttributeLanguage: NSString! let UIAccessibilitySpeechAttributePitch: NSString!

    Objective-C

    NSString *const UIAccessibilitySpeechAttributePunctuation; NSString *const UIAccessibilitySpeechAttributeLanguage; NSString *const UIAccessibilitySpeechAttributePitch;

    Constants

    • UIAccessibilitySpeechAttributePunctuation

      UIAccessibilitySpeechAttributePunctuation

      The value of this key is an NSNumber object that you should interpret as a Boolean value. When the value is YEStrue, all punctuation in the text is spoken. You might use this for code or other text where the punctuation is relevant.

      Available in iOS 7.0 and later.

    • UIAccessibilitySpeechAttributeLanguage

      UIAccessibilitySpeechAttributeLanguage

      The value of this key is an NSString object containing a BCP-47 language code. When applied to text in a string, the rules for the specified language govern how that string is pronounced.

      Available in iOS 7.0 and later.

    • UIAccessibilitySpeechAttributePitch

      UIAccessibilitySpeechAttributePitch

      The value of this key is an NSNumber object containing a floating-point value in the range 0.0 to 2.0. The value indicates whether the text should be specified spoken with a higher or lower pitch than the default. The default value for this attribute is 1.0, which indicates a normal pitch. Values between 0.0 and 1.0 result in a lower pitch and values between 1.0 and 2.0 result in a higher pitch.

      Available in iOS 7.0 and later.

  • Identifiers that you can use when pausing and resuming assistive technologies.

    Declaration

    Swift

    let UIAccessibilityNotificationSwitchControlIdentifier: NSString!

    Objective-C

    NSString *const UIAccessibilityNotificationSwitchControlIdentifier;

    Constants

    • UIAccessibilityNotificationSwitchControlIdentifier

      UIAccessibilityNotificationSwitchControlIdentifier

      The Switch Control technology. This technology allows users with mobility impairments to access an app using a single physical button. When this technology is enabled, iOS cycles a cursor around the screen from element to element. Users press their switch to operate on the element under the cursor.

      Available in iOS 8.0 and later.

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

    Declaration

    Swift

    enum UIAccessibilityNavigationStyle : Int { case Automatic case Separate case Combined }

    Objective-C

    typedef enum UIAccessibilityNavigationStyle : NSInteger { UIAccessibilityNavigationStyleAutomatic = 0, UIAccessibilityNavigationStyleSeparate = 1, UIAccessibilityNavigationStyleCombined = 2, } UIAccessibilityNavigationStyle;

    Constants

    • Automatic

      UIAccessibilityNavigationStyleAutomatic

      The assistive technology will automatically determine how the receiver's elements should be navigated. This is the default value.

      Available in iOS 8.0 and later.

    • Separate

      UIAccessibilityNavigationStyleSeparate

      The receiver's elements should be navigated as separate elements.

      Available in iOS 8.0 and later.

    • Combined

      UIAccessibilityNavigationStyleCombined

      The receiver’s elements should be combined and navigated as a single item.

      Available in iOS 8.0 and later.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 8.0 and later.