2011-12-01 117 views
0

哈ii我每個人都有一個tableview,當我點擊單元格時,它會彈出一個視圖,它的工作適合我,但是我的問題是,我想點擊2秒彈出出現。也就是說,如果我點擊單元格2秒,然後只彈出appers.Is那可能嗎?我怎麼能做到這一點?如何設置在tableview中觸摸單元格的時間?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
[self.view addSubview:MainPopupView]; 
//MainPopView is the popup that i want to display after2 minit 
} 

在此先感謝。

回答

2

UILongPressGestureRecognizer一試。您可以設置minimumPressDuration來設置識別手勢的時間。

您可以將UILongPressGestureRecognizer添加到您的表格視圖單元格中並獲得所需的操作。

更新 請看一看這個以前SO質疑How can I determine if a user has pressed on a UITableViewCell for 2 seconds?

+0

我知道longtapgesture的類refrence,但我怎麼能在didSelectRowAtIndexPath方法實現?thnks。 – ICoder

+0

看到這個以前的SO問題http://stackoverflow.com/questions/3924446/long-press-on-uitableview/3924965#3924965給你一個起點 – visakh7

+0

看到我的答案更新 – visakh7

相關問題