这是我的情况,我将UITapGestureRecognizer
添加到我的自定义UITableViewCell
的子视图中,我将识别器的目标设置为我的tableviewcontroller,所以我想知道如何从我的这个单元格的indexPath中获取tableviewcontroller的动作方法。
答案 0 :(得分:0)
- (IBAction)recognizerAction:(id)sender {
UITapGestureRecognizer *recognizer = sender;
if (recognizer.state == UIGestureRecognizerStateRecognized) {
YourCell *cell = (YourCell *)recognizer.view;
NSIndexPath *indexPath = [yourTableView indexPathForCell:cell];
[self doSomethingWithIndexPath:indexPath];
}
}