简体   繁体   中英

Direct Interaction with Voice Over?

My app is content a single tap with 3 types : 1 fingertap, 2 fingerstap and 3 fingerstap and some swipe gestures.

But when Voice Over is Turn-On they cannot detect a tap correctly.

I have tried

if (UIAccessibilityIsVoiceOverRunning()) {

UIView *interactionView = [[UIView alloc]init];

[self.view addSubview:interactionView];

[self.view bringSubviewToFront:interactionView];

[interactionView setAccessibilityTraits:UIAccessibilityTraitAllowsDirectInteraction]; }

But it doesn't work with the tap

To be able to process the taps ( touchesBegan:withEvent: etc.) with VoiceOver turned on, you need to set two variables of an UIView:

    view.accessibilityTraits = UIAccessibilityTraitAllowsDirectInteraction;
    view.isAccessibilityElement = YES;

You didn't set the latter. However, please keep in mind that doing that disables some default gestures made over that view. If you don't want that and just need the basic gestures instead of full control over touches, try adding gesture recognizer ( addGestureRecognizer: ) like UITapGestureRecognizer to the view.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM