[UINavigationController的RootViewController在另一个UINavigationController呈现UINavigationController时未解除分配

问题描述 投票:0回答:1

我有一个用于应用程序的主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)
ios uinavigationcontroller swift5
1个回答
0
投票

在此示例中,rootViewControllerlet声明保留。

© www.soinside.com 2019 - 2024. All rights reserved.