我可以在不使用这样的代码的情况下从导航 Controller 堆栈中删除 View Controller 吗
[mynavigationController popViewControllerAnimated:YES];
我们将不胜感激。
最佳答案
@rishi 几乎做到了。您需要一个可变数组来进行编辑
NSMutableArray *activeControllerArray =
[self.navigationController.viewControllers mutableCopy];
[activeControllerArray removeObjectAtIndex:indexToRemove];
// If you still have a handle to the viewcontroller you could use other methods like removeObject:
self.navigationController.viewControllers = activeControllerArray;
片段来自 UINavigationController docs
@property(nonatomic, copy) NSArray *viewControllers
... Assigning a new array of view controllers to this property is equivalent to calling the setViewControllers:animated: method with the animated parameter set to NO.
关于iphone - popViewController iphone,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8635107/