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:
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.
回答2:
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];
回答3:
I have set setSelectedIndex after push statement and it worked.
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.