如何在同一视图中使用AppNavigationController和AppNavigationDrawerController

时间:2017-12-22 17:26:26

标签: ios swift uinavigationcontroller material-design cosmicmind

我想在同一个视图中使用AppNavigationController和AppNavigationDrawerController,但是看不到它。感谢

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    FirebaseApp.configure()
    let leftViewController = LeftViewController()
    let root = PatientListController()
    let appToolbarController = AppToolbarController(rootViewController: root)
    let appNavigationController = AppNavigationController(rootViewController: appToolbarController)
    let appNavDrawerController = AppNavigationDrawerController(rootViewController: appNavigationController, leftViewController: leftViewController)
    window = UIWindow(frame: UIScreen.main.bounds)
    window!.rootViewController = appNavDrawerController
    window!.makeKeyAndVisible()


    return true
}

Result

1 个答案:

答案 0 :(得分:0)

目前我在同一页面中使用 NavigationDrawerController ToolbarController 。我做了类似这样的 AppDelegate.swift 文件。

import UIKit
import Material

extension UIStoryboard {
    class func viewController(identifier: String) -> UIViewController {
        return UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: identifier)
    }
}

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        Override point for customization after application launch.

        let appToolbarController = AppToolbarController(rootViewController: DashboardVC())
        let leftNavigationVC = LeftNavigationVC()

        window = UIWindow(frame: Screen.bounds)
        window!.rootViewController = AppNavigationDrawerController(rootViewController: appToolbarController, leftViewController: leftNavigationVC, rightViewController: nil)
        window!.makeKeyAndVisible()

        return true
    }
}

BTW,我使用的是Swift 3。