MMDrawerController不能closures抽屉

我正在尝试在我的应用程序中使用MMDrawerController,但是我不能在侧视图中使用手势closures侧抽屉。 我已经在我的应用程序中的其他地方使用MMDrawerController取得了巨大的成功,但不知道为什么它不在这种情况下工作。

顶级视图控制器是一个UINavigationController,其默认视图控制器是MasterViewController(下面的源代码)。 这个类扩展MMDrawerController并为我想要的configuration视图(中间和右侧,closures手势,最大宽度)。 中央视图有一个打开抽屉的button。 抽屉打开后,我无法用中间视图上的手势将其closures。 我添加了一个button到抽屉,它可以closures抽屉编程,但我需要能够选项卡/平移中心视图。

类MasterViewController:MMDrawerController {

override func viewDidLoad() { let centerView = storyboard!.instantiateViewControllerWithIdentifier("CenterControllerName") as? CenterControllerType super.setCenterViewController(centerView, withCloseAnimation: false, completion: nil) let drawer = storyboard!.instantiateViewControllerWithIdentifier("Drawer") as? DrawerType super.rightDrawerViewController = drawer super.setMaximumRightDrawerWidth(200, animated: true, completion: nil) super.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.PanningCenterView | MMCloseDrawerGestureMode.TapCenterView } 

}

打开抽屉的function:

 @IBAction func drawerButtonPressed(sender: AnyObject) { drawer?.openDrawerSide(MMDrawerSide.Right, animated: true, completion: nil) } 

我能够通过将一个ContainerView作为我的视图中的唯一对象,然后从我的ViewControllerconfigurationMMDrawerContainer解决此问题。 它似乎不是正确的答案,但从用户的angular度来看,一切都看起来和function正确。

好,所以我遇到了同样的问题,我几乎可以肯定的是它来自这个:

guddrawing.png

好的,VC1(带星号)是我们的应用程序主页,VC2是左边的抽屉,VC3是DrawerController。

在很长一段时间里,我试图把手势函数放在VC1和VC2中,但是只能在VC1中打开,而在VC2中closures会起作用。 我在VC1中使用的function:

 let rightSwipe = UISwipeGestureRecognizer(target: self, action: Selector("showDrawer:")) rightSwipe.direction = .Right view.addGestureRecognizer(rightSwipe) ... func showDrawer(sender: UISwipeGestureRecognizer) { if let m = mmdc { if !m.isLeftDrawerOpen() { m.toggleDrawerSide(MMDrawerSide.Left, animated: true, completion: nil) } } } 

和VC2中的一样,但用LeftSwipe和closeDrawer。

解决方法是把这些function和手势识别器都放在VC3(DrawerController)中。

问题是由于你的手势是为一个给定的VC定义的,但是当你打开抽屉时,它将改变当前的VC,并且之前的VC只是被显示,但是不能被交互。 把东西放在VC1 / VC2的父VC中就可以解决问题。