HidesBottomBarWhenPushed ignored in iOS 7

This code worked until iOS 7. I assign UIViewController , hidesBottomBarWhenPushed as YES , as rootViewController for UINavigationController . But TabBar is shown anyway. Here is the relevant code:

 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,...]; 

Anyone with a similar problem?

+8
ios ios7 uitabbarcontroller uinavigationcontroller
source share
3 answers

I found that the order in which methods and properties are called affects the display of the tab bar.

If I put self.hidesBottomBarWhenPushed = YES; in the viewDidLoad method of the viewDidLoad controller, I click the tab bar button. If I move it to the init method, the tab bar is hiding, just like on iOS 6.

+23
source share

The only workaround I found was to make tabBarController start on another tab ( [tbController setSelectedIndex:1]; ) and then in the viewWillAppear: method of this tab ViewController do [tbController setSelectedIndex:0];

+2
source share

I set setSelectedIndex after the push statement and worked.

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

The only problem is that you are showing your controller at the 0th index to be displayed. In this case, I set the mt tabbarcontroller index as 1 (other than 0). And his job.

+1
source share

All Articles