UIGestureRecognizer and UITableViewCell issue

Instead of adding the gesture recognizer to the cell directly, you can add it to the tableview in viewDidLoad.

In the didSwipe-Method you can determine the affected IndexPath and cell as follows:

-(void)didSwipe:(UIGestureRecognizer *)gestureRecognizer {

  if (gestureRecognizer.state == UIGestureRecognizerStateEnded) {
        CGPoint swipeLocation = [gestureRecognizer locationInView:self.tableView];
        NSIndexPath *swipedIndexPath = [self.tableView indexPathForRowAtPoint:swipeLocation];
        UITableViewCell* swipedCell = [self.tableView cellForRowAtIndexPath:swipedIndexPath];
        // ...
  }
}

Leave a Comment