Reputation: 1682
I have a tableview in which Edit mode is enabled, so the user can swipe in any direction on a cell to bring up the delete button. However, I have a gesture on the whole tableview for right swipes to do something else, unrelated to the deletion. I would like it if the swipe to delete only worked on a left swipe, so that my gesture recognizer would be called on the right swipe. Right now, the tableview swipe completely overrides my gesture recognizer.
Is there any way to fix this?
Thanks,
Upvotes: 1
Views: 1046
Reputation: 2545
You just need to add a SwipeGesture to tableView and important thing is do not set the delegate of swipeGesture and do not implement gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer
function.
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(callYourMehod:)];
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
[self.table addGestureRecognizer:swipeRight];
It should work as I have implemented and used it in my code This is how table cells will not go in edit mode on right swipe.
Upvotes: 4