Reload UItabbar view when using selectedIndex

Posted by Hetal Vora on Stack Overflow See other posts from Stack Overflow or by Hetal Vora
Published on 2010-03-09T07:20:06Z Indexed on 2010/03/09 7:21 UTC
Read the original article Hit count: 853

Filed under:
|
|
|
|

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.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about tab