应用程序包含多个导航 Controller 。 (下面的例子)
NavigationController1 ----> ViewController1 ---> TabBarController -->
NavigationController2 ----> ViewController2
每当 ViewController1 消失时,我都会使用 NavigationController.view.removeFromSuperview
删除 NavigationController
我在加载 ViewController2 时面临的问题。我只是看到一个黑屏没有别的。可能是什么问题?
移除 navigationController 的最佳方法是什么?
最佳答案
黑屏只不过是 UIWindow
。当您删除 NavigationController 时,窗口没有任何 NavigationController。因此,您必须在删除第一个 NavigationController 后立即为窗口设置 NavigationController。
你可以这样尝试:
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
appDelegate.window?.rootViewController = YOUR_NAVIGATION_CONTROLLER_OBJECT;
关于ios - 以编程方式删除 NavigationController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38768561/