I have 3 viewControllers, From the first i go to the second, and from the second to the third.
I want to go from the third view controller back to the first.
One solution I found is to create a custom button and replace the back button, this way I perform my own selector and go back to the firstVC. But the button I created doesnt look like the back button.
So one solution I thought about is:
Once I enter the third view controller, alter the viewControllers arrays in the navigationController removing the second view controller. This way it would go back to the first without changing the back button.
Is this possible? can I change the UINavigationController stack at will?
Thanks in advance
I don’t know the details of what you are doing but you want to avoid going back twice when the user expects to go back once with that back button. I would think a good solution would be to have some other action on the view.
So I assume from what you said that if the user goes to that view they need to go back to the start and cannot go back to the second view controller. On the third VC I would hide the back button or the navigation bar completely and then have another button on the view that clearly does some action and then you can just popToRootViewController.