How to get the cell location for finger clicks:
1, first create a long press (can be clicked or other gestures)
Uilongpressgesturerecognizer * Longgr = [[Uilongpressgesturerecognizer alloc] initwithtarget:self action: @selector ( Handlelongpress:)]
2, implemented in a method
-(void) Handlelongpress: (Uilongpressgesturerecognizer *) recognizer
{
If it is a start click
if (recognizer.state = = Uigesturerecognizerstatebegan)
{//Get the Indexpath of the current click
Cgpoint location = [recognizer LocationInView:self.tableView];
Nsindexpath * Indexpath = [Self.tableview indexpathforrowatpoint:location];
Calculates a rect based on index
CGRect Rectintableview = [Self.tableview Rectforrowatindexpath:cellindexpath];
CGRect Rectinsuperview = [Self.tableview convertrect:rectintableview toview:[self.tableview Superview]];
The Rectinsuperview here is the location of the cell that your current finger points to.
}
}
IOS "Gesture Get cell location" "Click cell Get Indexpath"