开发者

Is it possible to refresh the TabbarController when a user selects a particular tab in iPhone?

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...

Tha开发者_StackOverflow中文版nx in advance...

Plz help me.....


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜