I have such requirements.
My view controller is loading data from remote rest service and the data is presented in the table. Before loading process start I need Voiceover to say
"Loading buildings. Please wait"
after loading data success I need Voiceover to say
"Buildings loaded"
and after this I need to say what is in title in my view controller so
"Choose a building".
The order is very important. Now the Voiceover is reading at the beginning after loading controller what is in title of controller. When my buildings data loading is started the "Choose a building" title message is interrupted and "Loading buildings. Please wait" is started. Blind person needs to be informed about this states in correct order so after the data is loaded I need to say "Choose a building".
I need to take control over spoken messages order. I need to control when the controller.title content is spoken or to disable controller.title from voiceover.
To inform voiceover to say something I'm using this piece of code:
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, @"Buildings loaded");
The UIAccessibilityScreenChangedNotification is bugged. This SHOULD be doing what you want.
An alternative would be the following:
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, @"Buildings loaded");
HOWEVER, this is also bugged, yay APPLE! Your only option to get the behavior you want is to hijack the screen changed notification, as it is the only one that isn't bugged as of iOS 8.2.
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, @"Say these words please");
This provides the extra little Beep-Boop thing in VoiceOver, but that's not terrible. So, this would work for you, however, the solution I would suggest from an A11y point of view would be the following:
When you load up your viewcontroller, and the please wait diologue appears, move focus to it. Presumably, this is actually Modal (meaning you can't interact with the rest of the application until this is done). Instead of providing a string to be announced, if you provide a UIElement, focus will shift to the element, and it will be read out.
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, _PleaseWaitLabel);
Then, when loading is finished, do this:
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, _ChooseABuildingHeading);
Skip the "buildings loaded" announcement altogether, it isn't necessary, as long as your waiting announcement is Modal, and you shift focus to the proper heading afterward, it will be apparent what is going on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With