本文介绍了迅捷的MMDrawerController:要更改rootViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MMDraweController.它完美地工作.我对rootViewController有问题.当应用启动时,它将加载loginViewController.因此,我不希望在那里出现侧栏菜单(loginViewController没有任何导航控制器).我的问题是使用下面的应用程序代码是从viewController开始的,而不是loginViewController.如何使用没有侧栏菜单的登录页面和带侧栏的viewController?

I am using MMDraweController. It work perfectly. I have problem with rootViewController. When app starts it load loginViewController. So I dont want side bar menu there (loginViewController doesnt have any navigation controller). My problem is using code below the app starts from viewController, not loginViewController. How can I use login page with no side bar menu and viewController with side bar?

var rootViewController = self.window!.rootViewController

        let mainStoryBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)

        var centerViewController  = mainStoryBoard.instantiateViewControllerWithIdentifier("ViewController") as ViewController
        //var rootViewController = centerViewController

        var leftViewController = mainStoryBoard.instantiateViewControllerWithIdentifier("SideBarMenuViewController") as SideBarMenuViewController
        var leftSideNav = UINavigationController(rootViewController: leftViewController)
        var centerSideNav = UINavigationController(rootViewController: centerViewController)

        centerContainer = MMDrawerController(centerViewController: centerSideNav, leftDrawerViewController: leftSideNav)


        centerContainer!.openDrawerGestureModeMask = MMOpenDrawerGestureMode.PanningCenterView
        centerContainer!.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.PanningCenterView

        window!.rootViewController = centerContainer
        window!.makeKeyAndVisible()

推荐答案

在加载loginPageViewController时,只需输入以下代码:

When you load loginPageViewController just put this line of code:

 var appDelegate: AppDelegate =  UIApplication.sharedApplication().delegate as AppDelegate

    appDelegate.centerContainer!.openDrawerGestureModeMask = MMOpenDrawerGestureMode.None

这篇关于迅捷的MMDrawerController:要更改rootViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 06:29