Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift - disable accessibility voiceover?

I was curious if there was a way to disable the voiceover accessibility (or any other type of accessibility feature for that matter - like hear aids, captioning, etc.) in swift?

Essentially, I'm trying to build an application that has a very high likelihood of being used by people with visual impairments and I've tailored my entire application for such people.

But given that this target group may have the voiceover accessibility feature on, can I disable that only within my application?

enter image description here

I see that on xcode 7, underneath the identity inspector, there is a section for accessibility (picture below) and I tried unchecking that box but it seems like voiceover and the highlighting focus feature are still in effect. Let me know if you have any suggestions or comments, thanks.

like image 518
rj2700 Avatar asked Oct 25 '25 20:10

rj2700


2 Answers

You can set

element.accessibilityTraits = UIAccessibilityTraitAllowsDirectInteraction 

on any elements that you want to provide custom audio/interactions for.

like image 142
xoogler Avatar answered Oct 29 '25 02:10

xoogler


This can also be accomplished in storyboard (See photo).

I came across this thread because I was trying to do this for on a game scene tucked inside of a view container. To get it to work, I was able to set

.accessibilityTraits = UIAccessibilityTraitAllowsDirectInteraction

on each SKNode that had custom accessibility created for it, and then was able to select the proper options (again see screenshot) on the SKView -> View in Storyboard to allow the game screen to work.

Accessibility Options

like image 22
D. Pratt Avatar answered Oct 29 '25 03:10

D. Pratt