關(guān)于NavigationController

這個(gè)跟UINavigationController有什么區(qū)別呢?

其實(shí)就是對(duì)UINavigationController的封裝控制
let childNavigationController: UINavigationController

繼續(xù)看它是如何被構(gòu)造的

init(rootViewController: UIViewController = UIViewController()) {
        self.rootViewController = rootViewController
        self.childNavigationController = UINavigationController(rootViewController: rootViewController)
        super.init(nibName: nil, bundle: nil)
    }

    init(
        navigationBarClass: Swift.AnyClass?,
        toolbarClass: Swift.AnyClass?
    ) {
        self.rootViewController = UIViewController()
        self.childNavigationController = UINavigationController(
            navigationBarClass: navigationBarClass,
            toolbarClass: toolbarClass
        )
        super.init(nibName: nil, bundle: nil)
    }

功能舉個(gè)例子:

  1. 如何Push一個(gè)Coordinator
    func pushCoordinator(coordinator: RootCoordinator, animated: Bool) {
        //用dictionary記錄vc于coordinator的關(guān)系:
viewControllersToChildCoordinators[coordinator.rootViewController] = coordinator
  //
        pushViewController(coordinator.rootViewController, animated: animated)
    }

    func pushViewController(_ viewController: UIViewController, animated: Bool) {
        childNavigationController.pushViewController(viewController, animated: animated)
    }
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容