2011-12-09 120 views

回答

1

將一個UILongPressGestureRecognizer添加到表中。你可以通過調用indexPathForRowAtPoint找出用戶長按的單元格。

CGPoint p = [gestureRecognizer locationInView:self.myTableView]; 
NSIndexPath *indexPath = [self.myTableView indexPathForRowAtPoint:p]; 

查看the accepted answer to this question的完整示例。

+0

你也可以使用'[self.tableView indexPathForCell:cell]'得到索引路徑 – hypercrypt

+0

@hypercrypt但是我沒有手勢識別器回調中的單元格:它給我的只是一個觸摸點。 – dasblinkenlight

+0

你是正當的。 – hypercrypt

相關問題