I have UINavigationController, that contains TabBarController.
Tab Bar child controllers always hide bottom tab bar, no matter "Hides Bottom Bar On Push" selected or not.
Tried to set programmatically:
downloadViewController.hidesBottomBarWhenPushed = NO;
[self.navigationController pushViewController:downloadViewController animated:NO];
but still no effect.
Solved by removing navigation controller,
and adding navigation controller for each tab.
Related
The figure shows my storyboard, with segues as directed.
In the tabBar's landing viewcontroller (i.e. I), both tabBar and navBar are visible which is desired. However, if a segue is performed (from I) to go to another viewcontroller (here, II), I want only the navBar. I am able to hide the tabBar by using
self.tabBarController?.tabBar.isHidden = true
Next, I am able to achieve the desired result by adding navigation controller at the beginning as shown below.
This configuration will add a navbar to the viewcontrollers ahead (like splash screen) so I will have to hide the navbar in those viewcontrollers.
Is there other method that does not require to hide the bar(s) and achieve the desired effect?
You should go with your first approach. Tab bar controller have default property to hide bottom bar. See below sample code.
ViewController *viewController = [[ViewController alloc] init];
viewController.hidesBottomBarWhenPushed = YES; // This property needs to be set before pushing viewController to the navigationController's stack.
[self.navigationController pushViewController:viewController animated:YES];
This will hide your tab bar while pushing to any child controllers.
EDIT
You can also set hidesBottomBarwhenpushed from storyboard for your tabbar controller so you don’t have to write down any code.
I have a tab bar style application and once the user navigates into the application (selecting a tab bar), the tab bar is hidden using self.tabBarController?.tabBar.hidden = true in a viewDidLoad function
How can I reshow the tab bar later. I've tried self.tabBarController?.tabBar.hidden = false in both viewDidLoad and viewWillAppear.
There's a setting in the storyboard of the view controller that is going on the navigation stack:
if you check [x] Hide Bottom Bar on Push, the tab bar will be hidden when a view controller is pushed onto the navigation stack. It will also be unhidden when that view controller is removed (popped).
In most part of my iPhone application I want to show things with navigation controller and tab bar.
But for few screens I need more space so I want to remove the tab bar.
I found before calling the controller that doesn’t need the tab bar I can set to hide it,
CardImageViewController *cardImage = [[CardImageViewController alloc]
initWithNibName:#"CardImageViewController" bundle:nil];
cardImage.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:cardImage animated:YES];
[cardImage release];
The problem is now I can’t get it to display again. If I set
xxx.hidesBottomBarWhenPushed = NO;
for the next controller still I can’t see the tab bar
How do I get it to display.
The bar will remain hidden until you pop that controller that you hide off the navigation stack.
Refer to: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html
One way to solve this is to present modal view for those controllers that you want to hide the tab bar
In which view you want tab Bar hide use
cardImage.hidesBottomBarWhenPushed = YES;
this before push
and now in viewWillDisAppear of same view you need
cardImage.hidesBottomBarWhenPushed = NO;
I have a first view which has a funky menu thing. Then when you select a menu item it does [self presentModalViewController:tbc animated:YES]; (tbc being a tab bar controller with 5 navigation controllers within it).
In each of the navigation controllers I have a Home icon in the navigation bar.
I want to be able to link this button up to do the opposite of presentModalViewController:animated: and show the funky original menu system.
Is there any way to do this at all?
Thank you.
I can suggest you the following code
-(void)homeButtonClicked
{
[self.navigationController dismissModalViewControllerAnimated:NO];
[funkyTabbarController setSelectedIndex:0];
}
Plese try it.
I have made an application in which I have four tab bars. I have used the below code to go to the second view in a button's click method. It goes to the second view but the second view is not showing with tab bars. How can I fix this?
- (IBAction)Existinguser:(id)sender
{
ExistingUserViewController *existingUserViewController =
[[ExistingUserViewController alloc]
initWithNibName:#"ExistingUserViewController" bundle:nil];
[self presentModalViewController:existingUserViewController animated:YES];
[existingUserViewController release];
}
Presenting a view controller modally will show that view controller above all ther other UI elements (this includes the navigation bar and tab bar, but not the status bar).
If you want to show your "second view" as the view on the second tab, then you need to set the view controller you want to use as the second tab's view controller. That way when you press the second tab, the second view controller will be shown, and the second tab will be selected and visible.
I might be mistaken, but do you have a single tab bar with four tabs and you are looking for a way to change to the second tab? You can do this with the following code:
self.tabBarController.selectedIndex = 1;
btw the code you attached to your question is displaying a new model view controller above the current view controller. This is the reason no tabbar is shown.
If you are trying to create a navigation based app using tabbar, in IB, change the tab's viewcontroller to UINavigationController. You can then use the UINavController methods to navigate between views. In case you don't want to show the navbar, just set that property in IB.
Here's a good example of how you can use tab bar with navbar