我当前正在显示 UIViewController B
。我想推送 UIViewController C
并立即从导航堆栈中删除 B
,同时保留所有动画。最好的方法是什么?
最终堆栈将为A
、C
。
最佳答案
我不确定这是否是个好主意,但你可以这样做。
在你的 C View Controller 中,例如在 viewDidLoad 方法中放置此代码
NSMutableArray *viewControllerAfterRemove=[[NSMutableArray alloc]initWithArray:self.navigationController.viewControllers];
[viewControllerAfterRemove removeObjectAtIndex:1];
self.navigationController.viewControllers=viewControllerAfterRemove;
现在,当您在 C View Controller 中 popViewController 时,它会导航回A View Controller 。
关于objective-c - 弹出当前 UIViewController 并推送另一个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12614353/