如果我没有在[detailNavigationController popToRootViewControllerAnimated:NO]
viewControllers之前添加[detailNavigationController setViewControllers:...]
,则将这些推送到setViewControllers
没有收到viewWillDisappear且不会被释放。我检查了一下,然后转发了viewWillAppear
,viewDidAppear
等。我还尝试添加automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers
和shouldAutomaticallyForwardAppearanceMethods
分别返回YES(即使默认值已经为YES)。那些也没有用。
我可能做错了什么?
最佳答案
在设置ViewControllers之前在viewcotroller上调用autorelease
TestViewController * testView = [[[TestViewController alloc]initWithNibName @"TestViewController" bundle: nil]autorelease];
[self.navigationcontroller setViewControllers: @[testView] animated: YES];
关于ios - 为什么setViewControllers不触发viewWillDisappear和dealloc?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24473501/