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



现在我有一些非常简单的代码设置来识别手势。然而,当我的设备启用了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);
}

我注意到VoiceOver在音量静音时不会播放音调。你可能就是这样经历的吗?接收手势的功能仍然存在。

最新更新