Search code examples
iosiphoneswiftvoiceover

How to get the selected element of the iOS Voiceover


I have an iOS Swift App and i want to detect which element is selected by the voiceover.

Have tried to send an UIAccessibilitySwitchControlStatusDidChangeNotification but i don't get this to work.

NSNotificationCenter.defaultCenter().addObserver(
            self,
            selector: "handleVoiceoverSelection",
            name: UIAccessibilitySwitchControlStatusDidChangeNotification,
            object: nil)

...

func handleVoiceoverSelection(){
    println("!!!! element selected !!!!")
}

Is there any way?


Solution

  • Maybe check out UIAccessibilityFocus?

    https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIAccessibilityFocus_Protocol/index.html