How to disable accessibility for a view including

2019-03-17 21:21发布

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?

3条回答
放我归山
2楼-- · 2019-03-17 21:49

Just set the accessibilityElementsHidden property.

查看更多
在下西门庆
3楼-- · 2019-03-17 21:52

self.accessibilityElementsHidden = YES;

This makes all subviews hidden from accessibility.

查看更多
三岁会撩人
4楼-- · 2019-03-17 21:54

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.

查看更多
登录 后发表回答