VoiceOver parent and child views as accessibility elements

pawel221 picture pawel221 · Aug 9, 2016 · Viewed 8k times · Source

I have a simple UIView hierarchy. There is a parent view A which contains view B and C. If I set all views as accessibility element, only view A is accessible. Views B and C are not clickable. I need all views (A, B and C) to be accessibility elements.

I know you can achieve that by putting all views (A, B and C) at the same level, but view hierarchy in my app does not allow any changes.

Do you have any solution for that?

Answer

Justin picture Justin · Aug 10, 2016

Is view A an accessibility element? For subviews to be accessible, the containing view must not be an accessibility element.

view.isAccessibilityElement = false

If you need the third view, A, to be accessible, then make it a sibling view of B and C.