Iphone 带UINavigationController的UITABBARC控制器;“更多”;标签问题

Iphone 带UINavigationController的UITABBARC控制器;“更多”;标签问题,iphone,uinavigationcontroller,uitabbarcontroller,Iphone,Uinavigationcontroller,Uitabbarcontroller,带UINavigationController“更多”选项卡的UITabBarController问题 在UITabBarController中使用UINavigationController时出现问题。我有一个包含6项的选项卡。当然,会出现一个标准项“更多”,并且有两个uinavigationcontroller不适合于选项卡栏。问题的核心是:当我处理可见项(前四个)时,可以在UINavigationController中推送UIViewController: [self.navigation

带UINavigationController“更多”选项卡的UITabBarController问题

在UITabBarController中使用UINavigationController时出现问题。我有一个包含6项的选项卡。当然,会出现一个标准项“更多”,并且有两个uinavigationcontroller不适合于选项卡栏。问题的核心是:当我处理可见项(前四个)时,可以在UINavigationController中推送UIViewController:

[self.navigationController pushViewController:userDataViewController动画:是]

如果在“更多”中调用,并以这样的方式重新排列项目,则在调用它时,会出现一个可见的UINavigationController进入“更多”。此userDataViewController是最后一个,它已进入堆栈,后退按钮会返回到“更多”,但不会返回到控制器,在userDataViewController出现之前

我知道实际上选择器pushViewController是从“more”调用的,它将我的UINavigationController推到堆栈中,这并不好。也许有人遇到过这样的问题,可以帮我解决吗


谢谢转发

一种可能的解决方案是,在用户保存选项卡栏配置更改之前,强制您的UINavigationController返回其根视图控制器。为此,请在选项卡栏控制器的委托中实现以下方法:

- (void)tabBarController:(UITabBarController *)tabBarController willEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed {
    if (changed) {
        NSLog (@"User has rearranged tab bar items");

        for (UIViewController *controller in tabBarController.viewControllers) {
            if ([controller isKindOfClass:[UINavigationController class]]) {
                [((UINavigationController *)controller) popToRootViewControllerAnimated:NO];
            }
        }
    }
}

今天偶然发现了这个错误。这个给我修好了。非常感谢Aliaksei,我不得不添加
tabBarController.delegate=self之前,请注意这一点。这可能会有帮助: