VoiceOver 控件在隐藏时可选择

发布于 2024-12-26 14:18:06 字数 425 浏览 2 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淡淡の花香 2025-01-02 14:18:06

“记忆”部分让我认为您在删除子视图后没有执行类似 UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil) 的操作。

The "memorized" part makes me think you aren't doing something like UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil) after removing the subviews.

可是我不能没有你 2025-01-02 14:18:06

“accessibilityElementsHidden”的文档指出:

一个布尔值,指示元素是否可访问
此辅助功能元素中包含的内容被隐藏。 ..... 这
该属性的默认值为“否”。您可以使用此属性
隐藏新视图到达所覆盖的视图。在这个
在这种情况下,隐藏的视图可能在屏幕上仍然可见,但它们并不可见
用户操作的焦点。

您还可以使用此属性来隐藏瞬态视图,该视图
VoiceOver 用户无需注意。例如,VoiceOver 不
需要描述用户调整时出现的半透明视图
他们设备上的音量,因为此操作的听觉反馈
就足够了。

因此,基于此,为了让 VoiceOver 忽略这些子视图,您实际上需要在父视图上将其设置为“YES”。

The documentation for "accessibilityElementsHidden" states:

A Boolean value indicating whether the accessibility elements
contained within this accessibility element are hidden. ..... The
default value for this property is NO. You might use this property to
hide views that are covered by the arrival of a new view. In this
case, the hidden views might remain visible onscreen, but they are not
the focus of the user’s actions.

You might also use this property to hide a transient view that
VoiceOver users don’t need to notice. For example, VoiceOver doesn’t
need to describe the translucent view that appears when users adjust
the volume on their devices, because the aural feedback of this action
is sufficient.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文