Reload UItabbar view when using selectedIndex
- by Hetal Vora
Hi,
In my application I have 4 tabs in my tab bar. There is a navigation where if i click on a button on tab bar 2 view, it should take me to tab bar 3 view. I am doing this by using setting the selectedIndex property of tab bar like
appDelegate.tabBarController.selectedIndex = 2;
However, this doesn't reload the view of tab bar 3. It simply shows the tab bar 3 view that was last accessed (which may be down the navigation hieararchy in tab bar 3).
Please help as to how can i reload the root view of tab bar 3.
I tried having the delegate method of tabbar as below:
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
[viewController.navigationController popToRootViewControllerAnimated:FALSE];
}
but this works only if I click on a tab to go to the view and doesn't work with selectedIndex.Please help.