ios - 谁一直在用MMDrawerController,手势冲突怎么解决

标签 ios iphone uitableview uiscrollview mmdrawercontroller

我想使用 MMDrawerController在我的项目中。我的主页有一个 Scrollview和两个 tableview在 ScrollView 中。所以左滑和右滑MMDrawerController不起作用。请帮帮我。我看到[self.drawerController.centerViewController myCustomSubview]解决了这个问题?我不知道myCustomSubview这是什么?

最佳答案

UIGestureRecognizerDelegate提供了管理手势冲突的方法,并且 UIScrollView 公开了使用的手势,因此您可以提供更细粒度的控制。

如果将它们与 setGestureShouldRecognizeTouchBlock在抽屉 Controller 上,您应该能够管理冲突。

无论如何,这不能仅通过 setGestureShouldRecognizeTouchBlock 来实现。 .
您可以使用 shouldRequireFailureOfGestureRecognizer 来实现它实际禁用 ScrollView 手势。

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
    if (gestureRecognizer != self.panGesture || self.openSide != MMDrawerSideNone) {
        return NO;
    }
    CGPoint velocity = [self.panGesture velocityInView:self.panGesture.view];
    BOOL isHorizontalGesture = fabs(velocity.y) <= fabs(velocity.x);

    if(isHorizontalGesture) {
        CGPoint point = [gestureRecognizer locationInView:gestureRecognizer.view];
    if(([self isPointContainedWithinLeftBezelRect:point] && self.leftDrawerViewController) ||
       ([self isPointContainedWithinRightBezelRect:point] && self.rightDrawerViewController)){
            otherGestureRecognizer.enabled = NO;
            otherGestureRecognizer.enabled = YES;
            return YES;
        }
    }
    return NO;
}

关于ios - 谁一直在用MMDrawerController,手势冲突怎么解决,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28977146/

相关文章:

ios - 在 iOS 设备中创建 Bonjour AirPrint 服务

iphone - NSInternalInconsistencyException 原因 : '-[__NSCFArray replaceObjectAtIndex:withObject:]: mutating method sent to immutable object'

ios - 表格 View 不起作用

swift - 如何快速过滤 UITableView 中的多个字段

ios - 为什么我的 iOS 应用程序与旧设备(例如 iPhone 4S、5、iPad 2)不兼容?

ios - 如何以编程方式确定支持的应用程序方向?

ios - SKAction.playSoundFileNamed -- 如何将音量设置在 0.0 - 1.0 之间

iphone - 检查哪个 View 在iphone开发中处于顶部

iphone - 如何重新启动打开我的自定义 URL 方案的应用程序?

iphone - 代码 : lazy loading images from image data in core data