子视图控制器中的UIAccessibilityContainer? [英] UIAccessibilityContainer in child view controllers?
问题描述
我有一个父级 UIViewController
,向其中添加了四个子级视图控制器。我正在尝试管理所有这些控制器的可访问性。我有一个 status
枚举,该枚举跟踪屏幕上可见哪些孩子,所以当更改时,我正在更新 accessibilityElementsHidden
个孩子,并发送 LayoutChanged
通知。
I have a parent UIViewController
to which I add four child view controllers. I’m trying to manage accessibility throughout those controllers. I have a status
enum which keeps track of which of those children are visible on-screen, so when that changes, I’m updating the accessibilityElementsHidden
of the children as appropriate, and sending a LayoutChanged
notification.
我的问题与在父视图控制器和每个子视图控制器内部实现 UIAccessibilityContainer
协议。父母需要知道这些元素应该以什么顺序显示,等等,每个孩子都有自己的元素,这些元素也需要特定的顺序。
My question relates to implementing the UIAccessibilityContainer
protocol in both the parent view controller, and inside each of the child view controllers. The parent needs to know in which order those elements should be presented, etc., and each child has its own elements that also need specific ordering.
子类, UIAccessibilityContainer
方法( accessibilityElementCount
等)从未被调用,因此看起来就像在忽略它们,
It appears that inside the children, the UIAccessibilityContainer
methods (accessibilityElementCount
et al), are never called, so it looks like it’s ignoring them, which leaves my elements out of order and messy.
这是应该的样子吗?
推荐答案
是的,没错,UIAccessibilityContainer所做的就是告诉VoiceOver该元素从可访问性的角度来看,这是最内在的元素。
Yes, that is correct, what UIAccessibilityContainer is doing is telling VoiceOver that that element is the innermost element from an accessibility perspective.
能否从UI角度提供更多关于尝试执行的操作的上下文,也许有更好的方法实现这一目标
Can you give a bit more context as to what you are trying to do from a UI perspective, there might be a better way to achieve this
这篇关于子视图控制器中的UIAccessibilityContainer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!