NavigationDrawerController

NavigationDrawerController

我想在NavigationDrawerController https://github.com/CosmicMind/Samples/blob/master/Projects/Programmatic/NavigationDrawerController/NavigationDrawerController/RootViewController.swift的当前示例中对rootViewController进行pushViewController

以及TransitionedViewController https://github.com/CosmicMind/Samples/blob/master/Projects/Programmatic/NavigationDrawerController/NavigationDrawerController/TransitionedViewController.swift

如果我打电话给navigationController?.pushViewController(MyController(), animated: true),什么也没发生

如果将NavigationController附加到rootViewController,则在单击leftViewController时,中心rootViewController不会更改

(navigationDrawerController?.rootViewController as? ToolbarController)?.transition(to: TransitionedViewController(), completion: closeNavigationDrawer)

这是因为rootViewController没有NavigationController。如果我将AppToolbarController附加到rootView,则导航将不起作用;如果我将AppToolbarController附加到rootViewController,则navigationDrawer转换将不起作用。

请帮忙!

最佳答案

您的设置听起来像是它试图结合多个想法。因此,我有些困惑,但是从您的问题的标题为“如何在NavigationDrawerController中调用pushViewController”-从NavigationDrawerController调用pushViewController的代码(其中NavigationDrawerController.rootViewController是NavigationController)中执行此操作:

(navigationDrawerController?.rootViewController as? NavigationController)?.pushViewController(MyViewController(), animated: true)

让我知道这对您有多好:)

10-05 18:28