Iphone 如何从UIPangestureRecognitor中识别被触摸的细胞?
我正在使用UIPangestureRecognitor“拖动”单元格。我面临的问题是如何识别被触摸的细胞?didSelectRowAtIndexPath对我不起作用,因为用户实际上是从单元格中平移而不是选择它。有人有什么建议吗?谢谢 如果将手势识别器添加到Iphone 如何从UIPangestureRecognitor中识别被触摸的细胞?,iphone,ios,ipad,Iphone,Ios,Ipad,我正在使用UIPangestureRecognitor“拖动”单元格。我面临的问题是如何识别被触摸的细胞?didSelectRowAtIndexPath对我不起作用,因为用户实际上是从单元格中平移而不是选择它。有人有什么建议吗?谢谢 如果将手势识别器添加到UITableView,则在手势识别器目标中执行以下操作: CGPoint locationOfPan = [recognizer locationInView:self.tableView]; NSIndexPath indexPath =
UITableView
,则在手势识别器目标中执行以下操作:
CGPoint locationOfPan = [recognizer locationInView:self.tableView];
NSIndexPath indexPath = [self.tableView indexPathForRowAtPoint:locationOfPan];
然后可以从表视图中获取单元格
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
谢谢Wattson,这看起来正是我需要的。干杯