Looking for ios Answers? Try Ask4KnowledgeBase
Looking for ios Keywords? Try Ask4Keywords

iOS Accessibility Container


VoiceOver can navigate many apps on iOS because most UIKit classes implement UIAccessibilityProtocol. Features that don’t represent onscreen elements using UIView, including apps that leverage Core Graphics or Metal to perform drawing, must describe these elements for accessibility. As of iOS 8.0, this can be done by assigning a property on the UIView containing inaccessible elements:

myInaccessibleContainerView.accessibilityElements = @[elements, that, should, be, accessible];

Each object in the array can be an instance of UIAccessibilityElement or any other class that adheres to UIAccessibilityProtocol. The child elements should be returned in the order the user should navigate them. As an application author, you can use accessibility containers to override the default top-left to bottom-right ordering of VoiceOver swipe navigation. Given that UIView implements UIAccessibilityProtocol, you can combine instances of UIAccessibilityElement and UIView in the same array of child accessibility elements. Note that if you assign elements manually, you do not need to implement any dynamic accessibility protocol methods, though you may need to issue a screen change notification for the elements to be detected by VoiceOver.