27

When I set isAccessibilityElement = NO on a view that contains subviews with isAccessibilityElement = YES, VoiceOver still detects them.

I need to switch off accessibility for an entire view hierarchy that must be handled differently by VoiceOver. How can I achieve this without having to loop through every single item in the object graph and mess with it's setting?

Vinodh
  • 5,262
  • 4
  • 38
  • 68
openfrog
  • 40,201
  • 65
  • 225
  • 373

3 Answers3

33

self.accessibilityElementsHidden = YES;

This makes all subviews hidden from accessibility.

Şafak Gezer
  • 3,928
  • 3
  • 47
  • 49
Rakesh iOS Dev
  • 935
  • 12
  • 19
10

I would try setting the accessibilityElementsHidden property of the main view to YES. If that does not what you want, I would try overriding the UIAccessibilityContainer methods on the main view to return 0 children.

Boris Dušek
  • 1,272
  • 11
  • 12
4

Just set the accessibilityElementsHidden property.

kgreenek
  • 4,986
  • 3
  • 19
  • 30