在辅助功能模式下未检测到手势 [英] Gestures not getting detected in accessibility mode

查看:197
本文介绍了在辅助功能模式下未检测到手势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个应用程序,我需要在屏幕顶部放置一个标签,每当用户触摸它(或在其上方滑动手指)时,我需要大声读出标签文本。我尝试了以下方法:

I am programming an app where I need to put a label onto top of the screen and whenever user touches it (or swipes finger above it), I need the label text to be read out loud. I tried the following ways:

首先使标签的可访问性元素= YES

First make the accessibility element of the label = YES.

[labelInfo setIsAccessibilityElement:YES];

但这不起作用。
然后我尝试定义了许多手势,如两次触摸,单击;使用一个和两个手指等长时间点击,并在该手势类我写 UIAccessibilityPostNotification ,以便可以大声读出文本。但它似乎根本不起作用。我就这样做了:

But this doesn't work. Then I tried defining many gestures like two touches, single tap; long tap using one and two fingers etc., and in that gesture class I write UIAccessibilityPostNotification, so that the text can be read out loud. But it doesn't seem to work at all. This is how I did it:

UITapGestureRecognizer *TapOnLabel = [[UITapGestureRecognizer alloc] initWithTarget:labelInfo action:@selector(TapOnLabel:)];
[TapOnLabel setIsAccessibilityElement:YES];
[TapOnLabel setNumberOfTapsRequired:2];
[TapOnLabel setNumberOfTouchesRequired:1];
[labelInfo addGestureRecognizer:TapOnLabel];
[TapOnLabel release];

-(void) TapOnLabel:(UITapGestureRecognizer *)gestureRecognizer
{
  UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, @"Where am    I?");
  NSLog(@"%@",labelInfo.text);
}

我是否缺少某些东西,或者在辅助功能模式下没有手势,因为很多是预定义的。对于前者两个手指两个水龙头是音乐开/关等。
如果是这种情况,我需要至少滑动才能工作。对此有何看法?

Is there something I am missing or no gestures work in accessibility mode, because many are predefined. For ex. two finger two tap is music on/off etc. If this is the case, I need atleast swipe to work. Any thoughts on this?

P.S。我已经看到了类似问题的解决方案此处。但它特别适合缩放手势而对我没有帮助。此外,所有手势类都可以完美地工作,没有辅助功能模式,因此它们已被正确编写。

P.S. I have seen the solution of a similar question here. But it is particular to zoom gestures and not helpful to me. Also, all the gesture classes work perfectly without accessibility mode, so they have been written correctly.

推荐答案

手势全部被截获VoiceOver会。有一种手势直通模式,您可以在屏幕上双击并按住手指1秒钟。然后,您将听到一个音调,截取将被禁用,直到您抬起手指或完成手势。这基本上可以让你完成8个手势 - 四个滑动和四个拖动。

The gestures are all intercepted by VoiceOver. There is a gesture passthrough mode where you double-tap and hold your finger on the screen for 1s. You will then hear a tone and the intercept will be disabled until you lift your finger or complete a gesture. This gives you essentially 8 gestures you can then complete - the four swipes and the four drags.

但话说回来,为什么你的应用程序需要以这种方式运行?为什么你不能简单地添加辅助功能标签和/或提示,并允许VoiceOver焦点和触摸探索工作的设计?

But having said that, why does your application need to behave in this way? Why can you simply not add the accessibility label and/or hint and allow the VoiceOver focus and touch-to-explore work as they are designed?

这篇关于在辅助功能模式下未检测到手势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆