How to disable Direct Touch Area on MyApp

I need to disable Direct Touch Area in MyApp (a Unity App) using a Native framework.

I usually used UIAccessibilityTraits.allowsDirectInteraction = UIAccessibilityTraits.none or UIAccessibilityTraits.allowsDirectInteraction = UIAccessibilityTraits.notEnabled for this purpose, but after iOS 17.3 came out, none, or notEnabled worked anymore.

Do you have any other solution?

The idea is not asking the user to remove it manually by doing: Uncheck MyApp from Settings/Accessibility/VoiceOver/Rotor/Direct Touch Apps/MyApp

Thank you.

Upvotes: 0

Views: 136

Answers (1)

I solved the issue by doing this:

Since this is a Unity App and I'm using UAP for screen reading, I looked for all the active UIWIndow, then, I marked as not accessibleElement.

let view = UIView()
view.isAccessibilityElement = false
let windows = UIApplication.shared.windows
windows.forEach{singleWindow in
    singleWindow.isAccessibilityElement = false
}
    

This fixed the issue for me. If you have other alternatives, feel free to share them.

Upvotes: 0

Related Questions