我的手势识别器有问题。我的目标是在表视图中实现使用滑动删除。但我认为其他手势是相互冲突的。我正在使用这个库romonthego/REFrostedViewController https://github.com/romaonthego/REFrostedViewController这是我的汉堡菜单的库,并且该库具有手势功能。我认为冲突在于手势。因为当我在另一个项目中运行我的表格视图的代码时,它正在工作。请帮忙,先谢谢你。
我遇到了类似的问题,我最终所做的与 TonyMkenu 类似,但您需要允许更多识别器:
- (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;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)