2011-07-07 57 views
1

SWIP手势识别我使用下面的代码:问题与iOS的

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"); 
} 

但我没有看到任何输出,当我在模拟器上刷卡。任何人都可以请帮我吗?谢谢。

+0

你使用的是scrollView吗? – PengOne

+0

@PengOne:我有一个表格视图... – Ahsan

回答

1

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

+0

好吧,我仍然无法让它工作,但比以前更好!...感谢您的建议! – Ahsan