UINavigationController,力栈

UINavigationController, force stack

关于 UINavigationController 的问题

假设我有 5 个 UiViewController,每个都推送下一个。

vc1 --> vc2 --> vc3 --> vc4 --> vc5
vc1 <-- vc2 <-- vc3 <-- vc4 <-- vc5

如果我想在 vc1 上添加一个推送到 vc4 的 UIButton,但我还希望 vc4 在 popViewController 上转到 vc3

vc1 --> --> vc4
vc1 <-- vc2 <-- vc3 <-- vc4

最好的使用方法是:?

[self.navigationController setViewControllers:newViewControllers animated:NO];

如果你使用

[self.navigationController setViewControllers:newViewControllers animated:NO];

没有动画

那么,在 vc1 中试试这个

[self.navigationController pushViewController:vc2 animated: NO]; 
[self.navigationController pushViewController:vc3 animated: NO];
[self.navigationController pushViewController:vc4 animated: YES];