Is there any way to have VoiceOver read a label on command?

江枫思渺然 提交于 2019-12-04 05:17:01
Boris Dušek

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

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

Swift 4

UIAccessibility.post(notification: .announcement, argument: "Text")

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.

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

UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, elementToFocusOn)

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!