Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Initial VoiceOver selection

I'm adding VoiceOver support to my app. So far, so good, but I'd really like to be able to specify which element is the first one spoken after a UIAccessibilityScreenChangedNotification. I haven't seen a way to do this. Making something the summary element doesn't really seem to do it. Am I missing something?

like image 922
David Dunham Avatar asked Sep 22 '11 04:09

David Dunham


People also ask

What is VoiceOver on my Mac?

VoiceOver is a built-in screen reader that describes aloud what appears on your computer screen: it speaks the text that's in documents and windows. To turn on VoiceOver, press Command-F5.

What is VoiceOver on iPhone?

With VoiceOver—a gesture-based screen reader—you can use iPhone even if you can't see the screen. VoiceOver gives audible descriptions of what's on your screen—from battery level, to who's calling, to which app your finger is on. You can also adjust the speaking rate and pitch to suit your needs.


2 Answers

THis has always been perfectly possible to do.

Just write something along the lines of:

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];

    UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification,
                                self.myFirstElement);
}
@end

This works for both the UIAccessibilityScreenChangedNotification and the UIAccessibilityLayoutChangedNotification. More info: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIAccessibility_Protocol/Introduction/Introduction.html#//apple_ref/c/data/UIAccessibilityLayoutChangedNotification And here: http://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/Accessibility/AccessibilityfromtheViewControllersPerspective.html#//apple_ref/doc/uid/TP40007457-CH2-SW1

Now for Swift 5
override func viewDidAppear(_ animated: Bool) {
    UIAccessibility.post(notification: UIAccessibility.Notification.screenChanged,
                         argument: myFirstElement)
}
like image 85
Jeroen Leenarts Avatar answered Oct 16 '22 13:10

Jeroen Leenarts


I don't think there is an API value that specifies an order of reading, other than using Summary Element value on startup - it is by design.

So you would have to test the order and default for the UIKit elements or any custom controls, because it depends on your design. You can also mark items as non-accessible elements so they won't be 'read', accessible elements read by default, and containers for accessible elements to allow you to better control your intended interactions. I don't know if making the item selected will help.

I take it you are already using the Accessibility Inspector to test your application before testing on iOS.

If you are needing some background on the subject, Rune's Working With VoiceOver Support and Gemmell's Accessibility for Apps may be worth reading.

like image 2
Norman B. Robins0n Avatar answered Oct 16 '22 13:10

Norman B. Robins0n