iPhone:如何让VoiceOver识别标准手势

时间:2011-06-28 17:34:04

标签: iphone ios uigesturerecognizer

现在我有一些非常简单的代码设置来识别手势。但是,当我的设备启用了VoiceOver并且我尝试使用双击手势功能(通过voiceOver将手势传递到应用程序中)时,它似乎无法识别手势。

澄清更多: 通常情况下,如果您正在使用启用了配音的应用程序并且该应用程序具有一些手势识别功能,您可以双击并按住一秒钟,配音将播放音调。然后,您可以执行手势,它将通过画外音传递到应用程序中。我的问题是,当我双击并按住时,画外音不会发出声音。

所以我想知道是否有一些东西要包含在我的代码中以通知画外音我的应用程序将使用手势,或者其他类似的效果。

代码:

- (void)viewDidLoad
{
[super viewDidLoad];

// Swipe Left
UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc]
                                       initWithTarget:self action:@selector(handleSwipeLeft:)];

swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
[self.view addGestureRecognizer:swipeLeft];
[swipeLeft release];

// Swipe Right
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc]
                                        initWithTarget:self action:@selector(handleSwipeRight:)];

swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:swipeRight];
[swipeRight release];
}


- (void)handleSwipeLeft:(UISwipeGestureRecognizer *)recognizer 
{

CGPoint location = [recognizer locationInView:self.view];
NSLog(@"Swipe left started at (%f,%f)",location.x,location.y);
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, @"Swipe Left");
}

- (void)handleSwipeRight:(UISwipeGestureRecognizer *)recognizer 
{

CGPoint location = [recognizer locationInView:self.view];
NSLog(@"Swipe right started at (%f,%f)",location.x,location.y);
}

1 个答案:

答案 0 :(得分:0)

我注意到当音量静音时,VoiceOver不会播放音调。你正在经历的任何机会?接收手势的功能仍然存在。