Is it possible to change the order in which the VoiceOver feature for accessibility in iPad reads out the elements, when the 'Two-finger Flick Down' gesture is done?
For the attached image, which contains 3 labels and a button, the VoiceOver reads the elements in the following way,
Label 1 -> Label 2 -> Button -> Label 3
Can the order be changed to,
Label 1 -> Label 2 -> Label 3 -> Button
In Swift, attaching an IBOutlet to the parent UIView, then setting shouldGroupAccessibilityChildren to true will suffice.
I did note that if also setting
isAccessibilityElement = true
the grouping will not take effect. Similarly, checking the accessibility checkbox in the storyboard or xib will also prevent the grouping from taking place.I tried setting the
shouldGroupAccessibilityChildren
toYES
but it didn't work for me.What did work for me was setting the accessibility label of the parent view directly (because I wanted all the items to be read in one go/one VoiceOver gesture).
The above snippet of codes is from Apple's documentation Enhancing the Accessibility of Table View Cells
The quickest way to achieve this for your example is to place the three labels in a transparent
UIView
subclass to serve as a container for your labels. This subclass will have to be properly setup to let VoiceOver know how to interpret it. If your deployment target isiOS6
then you can simply answer the "should group accessibility children" question in this subclass.For below
iOS6
it would be more complicated, except that yourUIView
container subclass would contain onlyUILabels
which are accessibility elements. You could implement it like this:I have tested this example code and it does what you are looking for, if you need any clarification please add a comment. Always happy to help make things more accessible.
I think you can do it in the storyboard. The VoiceOver order is determined by the order of the views in the document outline.
Just drag and drop the views in the view hierarchy in the right order.