我发现当 tableview 被 UIPinchGestureRecognizer 声明为cellForRowAtIndexPath
. 现在想要找到被捏住的特定单元格的 indexPath。所以我写了这样的......
- (void)pinchDetected:(UIPinchGestureRecognizer*)gestureRecognizer {
CGPoint p = [gestureRecognizer locationInView:tblAccountsList];
NSIndexPath *indexPath = [tblAccountsList indexPathForRowAtPoint:p];
NSLog(@"indexPath.row = %@", indexPath.row);
UITableViewCell *pinchedCell = [tblAccountsList cellForRowAtIndexPath:indexPath];
NSLog(@"pinchedCell = %@", pinchedCell);
}
问题出在 indexPath.row 和单元格中,这两种情况的值都是空的。
所以,请有人帮我找到被夹住的 indexPath 或行。