0
votes

I have a TabbarController with 3 tabs with each tab representing a navigation Controller. What I would like to do is when a user selects a particular tab the whole tabbar Controller should refresh.

To make it more clear...

When a user selects tab0 and navigates in that tab 2-3 times and then the user selects tab1. Now when the user again selects tab0 it retains the last viewed ViewController. Can I make to show the first viewController in that tabbar NavigationController.

Can anyone help me in resolving this problem...

Any code will be very helpful...

Thanx in advance...

Plz help me.....

1

1 Answers

0
votes

Set yourself as the tab bar delegate and implement tabBar:didSelectItem: as per below.

You can then popToRootViewController on your relevant ViewController:

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
{
    if (item.tag == kRelevanTabBarIndex) {
        [self.relevantNavController popToRootViewControllerAnimated:NO];
    }
}

Cheers, Rog