1

我正在使用 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)

    }

}

知道为什么它不起作用吗?

4

1 回答 1

2

最后我通过添加 appDelegate 来修复它didFinishLaunchingWithOptions

let drawer = application.windows.first?.rootViewController as! MMDrawerController
drawer.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.PanningCenterView | MMCloseDrawerGestureMode.TapCenterView
于 2015-07-16T13:29:57.817 回答