This is probably easily sorted but I can’t figure it out. I have a tab bar application with two tabs, each tab has a UINavigationController.
Let’s say that I in tab 1 push a viewcontroller called ItemViewController, then I go to tab 2. From tab 2 I want to programatically display the ItemViewController. So it should first take me to tab 1 and then display the ItemViewController.
This is easily achievable by just tapping on the tab 1 tab item but I want to do this programtically for other reasons.
What I’m doing right now to achieve this:
[tab1NavController popToRootViewControllerAnimated:NO];
[tabBarController setSelectedIndex:0];
[tab1NavController pushViewController:itemViewController animated:NO];
I would like to be able to do something like this in pseudo-code:
if(viewControllerIWantToDisplayIsOnNavStack)
[tab1NavController presentViewController:viewControllerIWantToDisplay];
else
//instantiate and pushviewcontroller onto stack
How can I achieve this?
So you don’t have to pop to root view controller in the tab 1 any more.