我正在使用MMDrawerController,除了我有self.navigationController?.navigationBarHidden = true
的两个视图外,它在任何地方都可以正常工作。在这些视图中,我可以打开滑块,但我无法关闭它,按钮不再响应。这是滑块中的代码:
let viewController = self.storyboard?.instantiateViewControllerWithIdentifier("ProfileViewController") as! ProfileViewController
viewController.currentUser = APP_DELEGATE.loggedInUser
let navigationController = self.mm_drawerController.centerViewController as! UINavigationController
navigationController.viewControllers = [viewController]
self.mm_drawerController.toggleDrawerSide(MMDrawerSide.Left, animated: true, completion: nil)
以及隐藏导航栏的个人资料页面上的那个:
@IBAction func menuTapped(sender: AnyObject) {
println("Profile: menu tapped")
if let drawer = self.mm_drawerController
{
drawer.toggleDrawerSide(MMDrawerSide.Left, animated: true, completion: nil)
}
}
知道它为什么不起作用?
答案 0 :(得分:2)
最后,我通过添加appDelegate didFinishLaunchingWithOptions
来修复它:
let drawer = application.windows.first?.rootViewController as! MMDrawerController
drawer.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.PanningCenterView | MMCloseDrawerGestureMode.TapCenterView