Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何从UIPangestureRecognitor中识别被触摸的细胞?_Iphone_Ios_Ipad - Fatal编程技术网

Iphone 如何从UIPangestureRecognitor中识别被触摸的细胞?

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

我正在使用UIPangestureRecognitor“拖动”单元格。我面临的问题是如何识别被触摸的细胞?didSelectRowAtIndexPath对我不起作用,因为用户实际上是从单元格中平移而不是选择它。有人有什么建议吗?谢谢

如果将手势识别器添加到
UITableView
,则在手势识别器目标中执行以下操作:

CGPoint locationOfPan = [recognizer locationInView:self.tableView];
NSIndexPath indexPath = [self.tableView indexPathForRowAtPoint:locationOfPan];
然后可以从表视图中获取单元格

UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];

谢谢Wattson,这看起来正是我需要的。干杯