我对 iOS 开发比较陌生,并且我遇到了弹出视图控制器的问题。UIViewControllers
按下后退按钮时,我需要从导航堆栈中弹出两个(或更多) 。因为我不希望它们都被动画化,所以我首先弹出除了最后一个未动画的所有内容,然后将最后一个动画弹出,但-viewWillDisappear
不会只为最后一个被调用。这是我的代码(这些是从 super 调用的UIViewController
,所有其他代码都是从它扩展而来的):
//popping all but last one - viewWillDisappear getting called for these
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:j] animated:NO];
//popping last one - viewWillDisappear not getting called for this one
[self.navigationController popViewControllerAnimated:YES];
//also tried this but with same result:
//[((UIViewController*)[self.navigationController.viewControllers objectAtIndex:j]).navigationController popViewControllerAnimated:YES];
有人知道我在这里做错了什么,或者你能指导我如何正确地实现我所需要的吗?