I have a problem in my gesture recognizers. My goal is to implement using swipe to delete in my table view. But I think other gestures are conflicting with each other. I'm using this libray romaonthego/REFrostedViewController this a library for my hamburger menu and this library has a pangesture feature. I think the conflict is w/in the gestures. because when I run my code of my tableview in another project it's working.Pls help, Thank you in advance.
I had a similar problem, what I ended up doing is similar to TonyMkenu , but there are more recognizers that you need to allow:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
if (otherGestureRecognizer.delegate == self )
return NO;
//if otherGestureRecognizer is swipe to delete from a UITableView cancel slide menu recognizers
if ([[otherGestureRecognizer.view class] isSubclassOfClass:[UITableView class]])
{
NSLog(@"Allow1 %@", [otherGestureRecognizer description]);
return YES;
}
if( [[otherGestureRecognizer.view class] isSubclassOfClass:[UITableViewCell class]] ||
[NSStringFromClass([otherGestureRecognizer.view class]) isEqualToString:@"UITableViewCellScrollView"] ||
[NSStringFromClass([otherGestureRecognizer.view class]) isEqualToString:@"UITableViewWrapperView"])
{
NSLog(@"Allow&Disable %@", [otherGestureRecognizer description]);
if(gestureRecognizer.delegate == self)
{//cancel the slide menu recognizer
gestureRecognizer.enabled = NO;
gestureRecognizer.enabled = YES;
}
return YES;
}
NSLog(@"Deny %@", [otherGestureRecognizer description]);
return NO;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With