Reputation: 403
I have implemented tab bar controller with four navigation controllers each one has its on root view controller.
Below is my scenario-
- While I am selecting a tab from tab bar controller the appropriate root view controller has been launched. From that root view controller I am pushing another view controller.
2.Now I am selecting a different tab and load its respective root view controller through its navigation controller.
Now again I am selecting a tab from tab bar was selected previously as describe in point 1 above. Now it is showing a view controller which was pushed previously from its root view controller.
I am facing issue as described by step by step scenarios in below image -
I want to launch root view controller instead of a view controller which was being pushed from that root view controller. Is it possible?
if any answer regarding my question on stack over flow please provide that stack over flow link or if any suggestion please provide to me. Thanks in advanced.
Upvotes: 1
Views: 26
Reputation: 119031
You need to intercept the tab bar touch so that, as well as switching the selected tab, the controller calls [currentNavController popToRootViewControllerAnimated:NO];
.
This can be done by the tab bar delegate tabBarController:didSelectViewController:
, which should keep a record of the previously selected view controller so that it can pop it to root - but only after the new view controller is shown.
Upvotes: 1