iOS中滑动手势识别器的问题

时间:2011-07-07 22:38:57

标签: ios uigesturerecognizer gesture swipe

我使用以下代码:

UISwipeGestureRecognizer *swipeRecognizer = 
   [[UISwipeGestureRecognizer alloc]
   initWithTarget:self 
   action:@selector(swipeDetected:)];
swipeRecognizer.direction = UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:swipeRecognizer];
[swipeRecognizer release];

- (void)swipeDetected:(UIGestureRecognizer *)sender {
NSLog(@"Right Swipe");
}

但是当我在模拟器中滑动时,我看不到任何输出。有人可以帮帮我吗?感谢。

1 个答案:

答案 0 :(得分:1)

由于您有UITableView,因此可能会阻止此操作。尝试将swipeGesture直接添加到tableView