该应用程序包含多个导航控制器。 (以下示例)
NavigationController1 ----> ViewController1 ---> TabBarController -->
NavigationController2 ----> ViewController2
只要ViewController1将显示,我就会使用NavigationController.view.removeFromSuperview
每当ViewController2加载时我面临的问题。我只是看到黑屏没有别的。可能是什么问题?
删除navigationController的最佳方法是什么?
答案 0 :(得分:1)
黑屏只不过是UIWindow
。当您删除NavigationController时,窗口没有任何NavigationController。因此,只要删除第一个NavigationController,就必须为窗口设置NavigationController。
您可以尝试这样:
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
appDelegate.window?.rootViewController = YOUR_NAVIGATION_CONTROLLER_OBJECT;
答案 1 :(得分:0)
可能会有所帮助:
[self.window addSubview:secondNavigationController.view];
在窗口中添加第二个导航控制器的视图。