Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

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?

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

like image 748
Connor Hargus Avatar asked Aug 02 '15 21:08

Connor Hargus


1 Answers

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.

like image 112
Boris Dušek Avatar answered Sep 30 '22 09:09

Boris Dušek