michael-martinez
michael-martinez

Reputation: 797

iOS VoiceOver - Cannot capture touches in ARKit

I have a functional ARKit with SceneKit session when VoiceOver is disabled.

I can capture touches using touchesBegan(_:).

When I activate VoiceOver however, the touches seem to be captured by the Accessibility framework. I am unable to get any feedback of user touches in the sceneView to implement custom actions.

I tried putting print statements in :

But none of them seems to be called. Is there any way to get any feedback of user touches when accessibility is enabled ? (I am simply trying to map some custom action on a double tap) Or to register to some accessibility notification to get some user touches feedback ?

I also observed the following warning which may be related :

[Accessibility] *** Assertion failure in -[SCNSceneAccessibility accessibilityContainer], @:10772554112.

@ [Accessibility] |SCNSceneAccessibility.m:44 -[SCNSceneAccessibility accessibilityContainer]|The view should have set our container

EDIT (Solution)

This final setup in storyboard allow to capture touches: 1) Ensure Accessibility is enabled in the main view 2) Ensure User Interaction Enabled is enabled 3) Ensure Allows Direct Interaction trait is enabled

Accessibility capture touches setup

Upvotes: 1

Views: 251

Answers (1)

XLE_22
XLE_22

Reputation: 5671

If you want to get any feedback of user touches, you must let VoiceOver know that your view can interpret touch events directly by setting its accessibilityTraits to UIAccessibilityTraitAllowsDirectInteraction.

You should get gestures notifications for this particular view telling your app is in charge of touch interception, not Voiceover.

If you want to insert accessible child views inside your screen view, I suggest you disable its accessibility flag because if a parent view is accessible, its children aren't.

Upvotes: 1

Related Questions