有没有办法让VoiceOver在命令中读取标签?

时间:2022-09-28 16:53:59

I'd like to have my QR code scanning app inform the user when it finds a QR code. For sighted users, this works using a label at the bottom that updates to notify the user. However, a blind user would have to tap on that label again to have it read by Voice Over. I would much prefer it to just read automatically.

我想让我的QR码扫描应用程序在找到QR码时通知用户。对于有视力的用户,这可以使用底部的标签进行更新以通知用户。但是,盲人用户必须再次点击该标签才能通过Voice Over读取。我更喜欢它只是自动阅读。

The closest I can find to this question is UIAccessibility - Read all the labels and buttons on the screen from top to down, which wasn't possible. While this doesn't bode well for my app, that was a year ago. Has Apple updated it's UIAccessibility protocol in any way to allow this?

我能找到的最接近这个问题的是UIAccessibility - 从上到下阅读屏幕上的所有标签和按钮,这是不可能的。虽然这对我的应用来说不是好兆头,那是一年前的事。 Apple是否以任何方式更新了它的UIAccessibility协议以允许此操作?

As a last resort I suppose I could play my own mp3 recording if VoiceOver is on.

作为最后的手段,我想如果启用VoiceOver,我可以播放自己的mp3录音。

Any help is greatly appreciated!

任何帮助是极大的赞赏!

2 个解决方案

#1


10  

You can make VoiceOver speak any string any time you want by calling:

您可以通过以下方式随时让VoiceOver说出任何字符串:

UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, NSLocalizedString("QR code has been detected", comment: ""))

UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification,NSLocalizedString(“已检测到QR码”,评论:“”))

There is no direct way to tell VoiceOver to speak updates of an element that VoiceOver cursor is not on. This (i.e. speaking the same content "manually") is a feasible workaround.

没有直接的方法告诉VoiceOver说出VoiceOver光标未打开的元素的更新。这(即“手动”说出相同的内容)是可行的解决方法。

#2


2  

You can move VoiceOver focus to an element by using the following:

您可以使用以下方法将VoiceOver焦点移动到元素:

UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, elementToFocusOn)

UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification,elementToFocusOn)

VoiceOver will then parse and read the accessibility properties associated with that element.

然后,VoiceOver将解析并读取与该元素关联的辅助功能属性。

#1


10  

You can make VoiceOver speak any string any time you want by calling:

您可以通过以下方式随时让VoiceOver说出任何字符串:

UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, NSLocalizedString("QR code has been detected", comment: ""))

UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification,NSLocalizedString(“已检测到QR码”,评论:“”))

There is no direct way to tell VoiceOver to speak updates of an element that VoiceOver cursor is not on. This (i.e. speaking the same content "manually") is a feasible workaround.

没有直接的方法告诉VoiceOver说出VoiceOver光标未打开的元素的更新。这(即“手动”说出相同的内容)是可行的解决方法。

#2


2  

You can move VoiceOver focus to an element by using the following:

您可以使用以下方法将VoiceOver焦点移动到元素:

UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, elementToFocusOn)

UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification,elementToFocusOn)

VoiceOver will then parse and read the accessibility properties associated with that element.

然后,VoiceOver将解析并读取与该元素关联的辅助功能属性。