VoiceOver 控件在隐藏时可选择
我有一个 UIView,其中包含一些控件(例如按钮、标签等)。我将此视图叠加到另一个视图上(使用 addSubview)。如果用户打开了 VoiceOver,他可以左右滑动来选择控件。但是,如果我隐藏视图,使控件不再可见,用户仍然可以滑动并选择它们(尽管它们实际上不起作用)。由于这对于盲人用户来说非常令人困惑,因此我希望阻止这种情况发生。我什至尝试删除包含控件的视图(使用removeFromSuperview),但用户仍然可以滑动来选择它们(尽管突出显示它们的小框不再位于正确的位置)。就像 VoiceOver 已经记住了这些控件曾经存在并将永远记住一样。
我还找到了属性“accessibilityElementsHidden”,并且我尝试在隐藏时包含控件的视图上将其设置为 YES,但这似乎也不起作用。
这是 VoiceOver 中的错误,还是我遗漏了什么?有解决方法吗?
谢谢。
I have a UIView which contains some controls (e.g. buttons, labels, etc). I overlay this view onto another view (using addSubview). If the user has VoiceOver on, he can swipe left and right to select the controls. However if I hide the view so the controls are no longer visible, the user is still able to swipe and select them (although they don't actually work). Since this is very confusing to a blind user, I would like to keep this from happening. I have even tried removing the view that contains the controls (using removeFromSuperview) but the user can STILL swipe to select them (although the little boxes which highlights them are no longer in the correct positions). It is like VoiceOver has memorized that those controls were once there and will remember that forever more.
I also found the property 'accessibilityElementsHidden' and I have tried setting that to YES on the view which contains the controls when it is hidden, but that does not seem to work either.
Is this a bug in VoiceOver, or am I missing something? Is there a workaround?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
“记忆”部分让我认为您在删除子视图后没有执行类似
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil)
的操作。The "memorized" part makes me think you aren't doing something like
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil)
after removing the subviews.“accessibilityElementsHidden”的文档指出:
因此,基于此,为了让 VoiceOver 忽略这些子视图,您实际上需要在父视图上将其设置为“YES”。
The documentation for "accessibilityElementsHidden" states:
So based on this, in order to have those subviews ignored by VoiceOver, you'd actually want to set this to "YES" on the parent view.