0

从我的一些ViewController堆栈中,UINavigationController我提出了另一个ViewController并且永远不会回来,但问题是deinit{}没有调用。在导航之前我应该​​如何ViewController从堆栈中删除每个?还是我应该使用其他方法?现在我的代码看起来像

let destinationVC = storyboard?.instantiateViewControllerWithIdentifier("revealViewController") as! SWRevealViewController
self.presentViewController(destinationVC, animated: true, completion: nil)
4

1 回答 1

2

首先,当您调用时,您将在层次结构之外presentViewController:animated:completion:呈现新的viewController 模态。navigationController's

如果您希望在navigationController层次结构中显示它,请使用:

self.navigationController!.pushViewController(destinationVC, animated: true)

如果你想改变视图层次结构,navigationController有一个属性viewControllers可以设置有或没有动画

self.navigationController!.setViewControllers([destinationVC],
           animated: true)

有关更多信息,请参阅iOS 开发人员库

于 2016-09-13T11:06:58.497 回答