KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Currently I have Long Pres Gesture Recognizers on four different TableViews (two in each storyboard scene, therefore two storyboard scenes). I create these LPGR's with the following code in my ViewDidLoad method... //Add Long Press Gesture Reconizer UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)]; lpgr.minimumPressDuration = 1; //seconds lpgr.delegate = self; [self.GolferOne addGestureRecognizer:lpgr]; [self.GolferTwo addGestureRecognizer:lpgr]; [self.GolferThree addGestureRecognizer:lpgr]; [self.GolferFour addGestureRecognizer:lpgr]; //Done Adding Long Press Gesture Reconizer Next I have another method that I want to NSLog where the LPG was pressed... CGPoint p = [gestureRecognizer locationInView:self.GolferOne]; NSIndexPath *indexPath = [self.GolferOne indexPathForRowAtPoint:p]; if (indexPath == nil) NSLog(@"long press on table view but not on a row [Golfer One]"); else NSLog(@"long press on table view at row %d [Golfer One]", indexPath.row); //Golfer Two p = [gestureRecognizer locationInView:self.GolferTwo]; indexPath = [self.GolferTwo indexPathForRowAtPoint:p]; if (indexPath == nil) NSLog(@"long press on table view but not on a row [Golfer Two]"); else NSLog(@"long press on table view at row %d [Golfer Two]", indexPath.row); //Golfer Three p = [gestureRecognizer locationInView:self.GolferThree]; indexPath = [self.GolferThree indexPathForRowAtPoint:p]; if (indexPath == nil) NSLog(@"long press on table view but not on a row [Golfer Three]"); else NSLog(@"long press on table view at row %d [Golfer Three]", indexPath.row); //Golfer Four p = [gestureRecognizer locationInView:self.GolferFour]; indexPath = [self.GolferFour indexPathForRowAtPoint:p]; if (indexPath == nil)
Tags (comma-separated)
Save Edits
Cancel