1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > NavigationController管理VC

NavigationController管理VC

时间:2021-07-26 05:44:36

相关推荐

NavigationController管理VC

场景:我从A到B,逻辑操作后跳到C,但是想到c返回的话会跳到B,但是不需要到B而直接到A,所以我从B到C的时候我想把self.navigationController里的B移除。c在2个地方用到。所以点击左上角返回按钮,就需要pop。

遇到的坑:

原来自己理解错了setViewControllers方法,set了之后就已经入栈了。所以不需要再次push一次。

修改后的代码:

SSICAViewController *ssicaVC = [[SSICAViewController alloc] init];NSArray *vcs = self.navigationController.viewControllers;NSMutableArray *currentControllers = [NSMutableArray arrayWithArray:vcs];[currentControllers removeLastObject];[currentControllers addObject:ssicaVC];[self.navigationController setViewControllers:currentControllers animated:YES];

最近在学习swift,也开始在项目中使用swift。之后会更新一波swift学习过程中遇到的坑。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。