现在我有一些非常简单的代码设置来识别手势。但是,当我的设备启用了 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 不会播放音调。有没有可能是你正在经历的?接收手势的功能仍然存在。
关于iPhone:如何让 VoiceOver 识别标准手势,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6510692/