VoiceOver accessibility in a virtual musical instrument iPhone app?
I have received comments from blind users that some of my sound and music related apps only work with VoiceOver off.
With VoiceOver Accessibility enabled on an iOS device, is it possible to enable a music keyboard or drum pad touch area so that music sounds can be played immediately, instead of VoiceOver prompts, when a keyboard key or virtual drum set (etc.) is tapped?
Just setting the UIAccessibilityTraitPlaysSound AccessibilityTrait on a UIView subview doesn't seem to do it. I get VoiceOver clicking instead of piano or drum sounds with VoiceOver enabled.
A blind user can turn Voic开发者_如何学JAVAeOver completely off, but then all the other buttons (Instrument selection, Configuration, Help, etc.) and/or controls will no longer will have VoiceOver assistance.
I can now answer my own question.
iOS 5 has added a new API exactly for this need:
[ mySubView setAccessibilityTraits: UIAccessibilityTraitAllowsDirectInteraction ];
will disable VoiceOver just for that UIView subview, but leave other subviews (other buttons, etc.) unaffected. This API allows an app to get responsive touch handlers more suitable for keying a musical instrument within the specified subview, even with VoiceOver enabled and providing assistance for other portions of the app's UI outside the specified UIView.
I don't think it's possible for you the developer to turn off VoiceOver, and as you've discovered it's impractical for users to play an instrument with Voiceover intercepting gestures.
I think it's acceptable to leave this in the hands of the user. It's easy to toggle Voiceover off/on by triple-tapping the home button, although this is off by default (users can turn it on via Settings > General > Accessibility > Triple-click Home). With that option engaged, users can explore your interface with Voiceover on, then toggle it off when they're ready to make music, and toggle it back on again when they're finished.
With that in mind you just need to be sure all interactive components (e.g., piano keys, parts of the drum kit) have meaningful labels.
精彩评论