gpt4 book ai didi

快速MMDrawerController : want to change rootViewController

转载 作者:可可西里 更新时间:2023-11-01 02:23:03 25 4
gpt4 key购买 nike

我正在使用 MMDraweController。它完美地工作。我对 rootViewController 有疑问。当应用程序启动时,它会加载 loginViewController。所以我不想要侧边栏菜单(loginViewController 没有任何导航 Controller )。我的问题是使用应用程序下面的代码从 viewController 开始,而不是 loginViewController。如何使用没有侧边栏菜单的登录页面和带侧边栏的 viewController?

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 时,只需放入这行代码:

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

appDelegate.centerContainer!.openDrawerGestureModeMask = MMOpenDrawerGestureMode.None

关于快速MMDrawerController : want to change rootViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29734298/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com