我有一个用于应用程序的主UINavigationController,现在我想为另一个流程展示另一个NavigationController。完成该流程后,我将解散另一个NavigationCotnroller,但是不会解除分配另一个NavigationController的rootViewController。(不会在另一个导航控制器的rootViewController上调用'deinit')。
下面是要理解的示例代码-
// main Navigation controller for the app
let navigationController = UINavigationController()
//another navigation controller to present separate flow of screens
let rootController = UIViewController()
let subNavigationController = UINavigationController(rootViewController: rootController)
navigationController.present(subNavigationController, animated: true, completion: nil)
//while dismiss - deinit on rootController is not getting called
navigationController.dismiss(animated: true, completion: nil)
在此示例中,rootViewController
被let
声明保留。