2011-07-07 62 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