Search code examples
iosaccessibilityvoiceover

Accessibility automatically reading the first element


I have an iOS application and I'm adding accessibility to it.

When a screen gets pushed the voice over automatically reads the first element on the screen - in my case, it reads my back button - a UINavigationBarButton on my UINavigationBar.

If I disable the accessibility from the back button - it will read my screen title instead + it will not read the back button when the user touches the back button.

So... How can I tell the voice over to shut up when I push a new screen? only talk when I tell it to or when the user is touching an element.

thanks.


Solution

  • VoiceOver will automatically read the first element of content when "Screen Changed" type of events occur. It does so by pushing a UIAccessibilityScreenChanged notification. The system will do this for you on certain types of transitions, segues, etc. You can't keep this from happening, nor should you. This is desired behavior. If you want to send focus to a more helpful location, something other than your UINavigationBar, you could consider posting the UIAccessibilityScreenChangedNotification yourself, and supplying it with a different view to focus.

    UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, viewToFocus);