开发者

How do you make the "more" button of a UITabBarController return to the root view

开发者 https://www.devze.com 2023-01-22 05:55 出处:网络
I have a UITabBarController which has been created programatically. There are 6 tabs within the tab bar which has forced a more button to appear, which is great and works beautifully!

I have a UITabBarController which has been created programatically. There are 6 tabs within the tab bar which has forced a more button to appear, which is great and works beautifully!

Whilst testing the app, one of the testers raised a point. When they select the more button, then select one of the options in the more menu, the resulting view is presented as expected. If they then select another tab from the tab bar and subsequently return to the more tab the view that they previously selected is still visible!

So, my question is this. How can I make the "more" button return to the table menu when it is selected? I have tried the obvious, as it is appears to be a subclass of UINavigationController I tried popping to root etc but to no avail... The iPod app does exactly what I want to do so I know its possible, just wondering if there is somethin开发者_如何学编程g I am missing?

Any help is appreciated

Graham Whitehouse


Try this delegate method:

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
    if ([tabBarController selectedIndex] > 3) {
        [viewController.navigationController popToRootViewControllerAnimated:NO];
    }
}
0

精彩评论

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