hidesBottomBarWhenPressed在iOS 7中被忽略

这个代码运行良好,直到iOS 7发布。 我分配一个UIViewController ,与hidesBottomBarWhenPushedYES ,作为UINavigationControllerrootViewController 。 但TabBar正在显示。 以下是相关的代码:

 Login *lv = [[Login alloc] init]; lv.HowToUseShows = showHowToUse; lv.hidesBottomBarWhenPushed = YES; UINavigationController *BokShelfNav = [[UINavigationController alloc] initWithRootViewController:lv]; //... UITabBarController *tbController = [[UITabBarController alloc] init]; tbController.viewControllers = @[BokShelfNav,...]; 

任何人有类似的问题?

我发现调用方法和属性的顺序对是否显示标签栏有影响。

如果我把self.hidesBottomBarWhenPushed = YES; 在视图控制器的viewDidLoad方法,我推动标签栏仍然显示。 如果我将它移动到init方法,则标签栏将隐藏起来,就像在iOS 6上一样。

我发现唯一的解决方法是使[tbController setSelectedIndex:1];在另一个选项卡( [tbController setSelectedIndex:1]; )中启动,然后,在该选项卡ViewController的viewWillAppear:方法[tbController setSelectedIndex:0];

push语句后,我已经setSelectedIndex它工作。

 //created tabbar controller object if(index==0) [tabbarcontroller setSelectedIndex:1]; [self.navigationcontroller pushViewcontroller:tabbarcontroller anmated:YES]; [tabbarcontroller setSelectedIndex:index]; 

唯一的问题是如果你显示你的控制器在第0指数,它会显示。 在这种情况下,我首先将mt tabbarcontroller的索引设置为1(与0不同)。 和它的工作。