i have a uitabbarcontroller which has 3 items. each item has its own navigation controller.
for example in tab 1 the user navigates to other subview and then changes to tab 2 and then back to the tab 1. the tab one shows the subview. how can i push the root view controller instead of the subview?
my uitabbarcontroller is customized and has:
-(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
is it the right place to do some kind of pushrootviewcontroller?
how to get the controller?
edit:
i have the following implemented
UITabBarController<UITabBarControllerDelegate, UITabBarDelegate>
and
-(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
if (tabBarController.selectedIndex == 0)
{
NSLog(@"test%@",@"test");
[self.tabBarController.selectedViewController.navigationController popToRootViewControllerAnimated:NO];
}
}
nslog output can be seen in the debugger but popto root doesnt work. any idea?
ok the code should look like this. and now it works the way i wanted.