How to replace viewController in the NavigationController stack?

I have a navigationController, I click on it with a new viewController, I tried to figure out a way to switch this ViewController with another viewController from within the first ViewController.

I have 3 almost identical views, depending on user interaction. I would like to be able to switch between these views in the same index index, i.e. without clicking or displaying views on the navigationController.

So, if the view C has index 3 on the navigationController stack, and the user selects a specific button in the form C, the view C1 replaces C with the stack and gets index 3.

I went through the UINavigation class and cannot find a way around this. If I popViewController from the current viewController and tries to pushViewController ... well, that cannot be done, as the viewController is freed when it appears. If I try to push PushViewController instead, then I will add on top of the current current viewController dispatcher.

I hope this makes sense and someone can help me :)

thanks

+4
source share
1 answer

You can assign NSArray controllers to the viewControllers property to instantly change the entire stack.

+12
source

All Articles