gpt4 book ai didi

iphone - popViewController iphone

转载 作者:行者123 更新时间:2023-11-28 23:09:31 27 4
gpt4 key购买 nike

我可以在不使用这样的代码的情况下从导航 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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com