Ios UINavigationController deinit从未调用
从我的Ios UINavigationController deinit从未调用,ios,swift,uinavigationcontroller,stack,deinit,Ios,Swift,Uinavigationcontroller,Stack,Deinit,从我的UINavigationController堆栈的一些ViewController中,我呈现了另一个ViewController,并且永远不会回来,但问题是没有调用deinit{}。导航之前,我应该如何从堆栈中删除每个ViewController?还是我应该用其他方法?现在我的代码看起来像 let destinationVC = storyboard?.instantiateViewControllerWithIdentifier("revealViewController") as! S
UINavigationController
堆栈的一些ViewController
中,我呈现了另一个ViewController
,并且永远不会回来,但问题是没有调用deinit{}
。导航之前,我应该如何从堆栈中删除每个ViewController
?还是我应该用其他方法?现在我的代码看起来像
let destinationVC = storyboard?.instantiateViewControllerWithIdentifier("revealViewController") as! SWRevealViewController
self.presentViewController(destinationVC, animated: true, completion: nil)
首先,当您调用
presentViewController:animated:completion:
时,您将在navigationController的
层次结构之外以模式呈现新的viewController
如果您希望在导航控制器层次结构中显示它,请使用:
self.navigationController!.pushViewController(destinationVC, animated: true)
如果要更改视图层次结构,则navigationController
有一个属性viewControllers
,可以设置动画或不设置动画
有关更多信息,请参阅。首先,当您调用presentViewController:animated:completion:
时,您将以模式方式在导航控制器的层次结构之外显示新的viewController
如果您希望在导航控制器层次结构中显示它,请使用:
self.navigationController!.pushViewController(destinationVC, animated: true)
如果要更改视图层次结构,则navigationController
有一个属性viewControllers
,可以设置动画或不设置动画
有关更多信息,请参阅。这有助于取消限制,但问题是我不希望我的目标ViewController嵌入NavigationController(位于其层次结构之外):我有简介VCs,在用户退出应用程序之前不会再显示。我明白了!=)听起来你们有两个不同的观景套房。我要做的是将应用程序UIWindow
的rootViewController
属性设置为所需的viewController
,或者最好有一个baseViewController可以在不同套件之间执行切换。我通过添加self.navigationController!解决了我的问题!。setViewController([],动画:false)
到viewdiddemouse
方法。不确定这是否是正确的方法,但至少它是有效的。这有助于消除干扰,但问题是我不希望我的目标ViewController嵌入NavigationController(位于其层次结构之外):我有简介VCs,在用户退出应用程序之前不会再显示。我明白了!=)听起来你们有两个不同的观景套房。我要做的是将应用程序UIWindow
的rootViewController
属性设置为所需的viewController
,或者最好有一个baseViewController可以在不同套件之间执行切换。我通过添加self.navigationController!解决了我的问题!。setViewController([],动画:false)
到viewdiddemouse
方法。不确定这是否是正确的方法,但至少它是有效的。