This code was working well until iOS 7 release. I'm assigning a UIViewController
, with hidesBottomBarWhenPushed
as YES
, as the rootViewController
of an UINavigationController
. But the TabBar is being shown anyway. Here's 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?
I found that the order in which methods are called and properties are set has an impact on whether the tab bar is shown.
If I put self.hidesBottomBarWhenPushed = YES;
in the viewDidLoad
method of the view controller I'm pushing the tab bar still shows. If I moved it to the init
method the tab bar hides as it used to on iOS 6.
The only workaround I've found is to make the tabBarController start in another tab ([tbController setSelectedIndex:1];
), and then, in the viewWillAppear:
method of that tab ViewController do [tbController setSelectedIndex:0];
I have set setSelectedIndex after push statement and it worked.
//created tabbar controller object
if(index==0)
[tabbarcontroller setSelectedIndex:1];
[self.navigationcontroller pushViewcontroller:tabbarcontroller anmated:YES];
[tabbarcontroller setSelectedIndex:index];
The only issue is if you are showing your controller at 0th index in that it will show. In this case I have first set mt tabbarcontroller's index as 1(different from 0). And its working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With