How to disable accessibility for a view including all it's subviews?

[亡魂溺海] 提交于 2019-11-29 11:51:20

问题


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?


回答1:


self.accessibilityElementsHidden = YES;

This makes all subviews hidden from accessibility.




回答2:


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.




回答3:


Just set the accessibilityElementsHidden property.



来源:https://stackoverflow.com/questions/17897392/how-to-disable-accessibility-for-a-view-including-all-its-subviews

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!