如何从 VoiceOver 中排除 UIButton? [英] How do you exclude a UIButton from VoiceOver?

查看:29
本文介绍了如何从 VoiceOver 中排除 UIButton?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个有时是空白的 UIButton(没有文本或图像).当它为空白时,我希望 VoiceOver 跳过它.我尝试了以下操作,但没有一个能完成工作——当用户在视图中滑动时,按钮仍然突出显示:

I have a UIButton that is sometimes blank (no text or image). When it is blank, I want VoiceOver to skip over it. I've tried the following things, but none of them do the job -- the button still gets highlighted as the user swipes through the views:

  • 将按钮及其所有子视图的 .accessibilityTraits 设置为 UIAcessibilityTraitNotEnabled.这可以防止 VoiceOver 在选择按钮时说出任何内容,但它仍然允许 VoiceOver 选择按钮.

  • Set the button and all of its subviews' .accessibilityTraits to UIAcessibilityTraitNotEnabled. This prevents VoiceOver from saying anything when the button is selected, but it still allows the button to be selectable by VoiceOver.

禁用按钮(我验证了该按钮在调试视图层次结构视图中被禁用).VoiceOver 仍可选择该按钮.

Disable the button (I verified that the button is disabled in the Debug View Hierarchy view). The button remains selectable by VoiceOver.

有人知道如何让 VoiceOver 跳过/完全忽略 UIButton 吗?

Anybody know how to make VoiceOver skip over / ignore a UIButton completely?

推荐答案

尝试以下操作:

someButton.isAccessibilityElement = NO;

这告诉按钮它不是一个可访问的元素.这应该可以防止画外音在按钮处停止.

This tells the button that it isn't an accessible element. This should prevent voice-over from stopping at the button.

这篇关于如何从 VoiceOver 中排除 UIButton?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆