Present view controller from UITabBarController without tab bar showing - ios

I have read multiple answers regarding this issue. The main thing indicated is to set hidesBottomBarWhenPushed to true, which i have done and is still not working for me.
So this is my storyboard layout.
So i present a TableViewController from my TabBarController, the view i present is the bottom left on the storyboard. With hidesBottomBarWhenPushed set to true, i expect the bottom bar to be hidden but this is not the case. It actually adds a new bottom bar and upon navigating back to the tab view a new tab bar is overlapping the original one. You can see this in the screenshots below.
So firstly the tab bar, we then select the filter icon on the top right, which triggers the segue to the next controller.
So now the next controller loads in. As you can see the tab bar is displayed even though i have set hidesBottomBarWhenPushed on the storyboard.
And now when we navigate back there is a new tab bar overlapping the original.
I don't have much experience with tab bar controllers, have i done something wrong with my storyboard hierarchy maybe. Perhaps each tab should have its own navigation controller. However my tab bar also needs a navigation controller.
Any help or suggestions is greatly appreciated.

In viewDidLoad of tableVC
self.tabBarController?.tabBar.isHidden = true
In viewWillAppear of the VC before the tableVC
self.tabBarController?.tabBar.isHidden = false

Related

How to keep NavigationController when performSegue from embeded tableviewcontroller

In the bottom left viewcontroller i have a searchbar at the top that call the tableview at the top , the problem is that i want to segue to the right viewcontroller with detail of it, but of course i'm losing my navigationController so when i'm into the right viewcontroller i can't go back anymore, how should i do to go back to my original Viewcontroller ?
Add Navigation Controller as the starting view in storyboard. And then Link RootViewController to it. This will ensure navigation bar in all the views coming next.
you may hide navigation bar in the view where not needed as
self.navigationController?.isNavigationBarHidden = true
push newViewController instead of presenting
Also please check, if you are presenting it modally. Modal segues take over the whole screen, so any navigation bars, tool bars, or tab bars that are in the presenting controller will be covered up. If you want a navigation bar on this modal controller, you'll need to add one specifically to it, and add any buttons you want to that new navigation bar (or tool bar). If you don't want to do this, then don't present it modally, do a push to it.

View controller problems with old navigation bar and tab bar controller

I have a view controller which was attached to a navigation controller at one point in time. it is still showing some ghost of the navigation bar? It is also showing the Tab Bar but there is not tab bar item shown on it?
any ideas how to fix this, or is it a delete and remake?
Its either the alpha of the rootVC or you have. tab bar controller on the second one. Check your identity inspector on both views

Weird nav controller behavior with different tab bar stacks

I have a tab bar controller with a nav bar embedded in each tab as root. I am using a detail view controller that will be accessed from 2 of these tab bar stacks. When accessing this view controller in it's own stack, everything works as expected. However, if the user is in the other tab and segues to this detail view controller, the view slips behind the navigation bar. Its like the nav bar isn't even there, it just goes underneath it. I've been scratching my head trying to figure out what's going on, any insights would be greatly appreciated!
Figured it out for those in a similar predicament. Need to add navigationController?.navigationBar.translucent = false in viewDidLoad. In iOS 7 this changed, by adding this line it won't slide the view beneath the nav bar.

iOS Swift: Incorrect Navigation Bar Appearing

The incorrect navigation bar is appearing on my Table View Controller screen (see Storyboard Below).
I would like what's displayed on the storyboard to be my navigation bar (i.e. with "Main Feed" title and Sign Out button on the top right). However, this is what I'm actually getting -
There are two issues here: 1) The incorrect navigation bar is displaying (this one has a login back button); 2) the first few table view cells are placed underneath the nav bar vs. under it.
This happened after I embedded the Table View controller in the Tab Bar Controller. I want a bottom tab bar in the main portion of my application hence the reason why I added the Tab Bar Controller. Any suggestions on how to fix this? Rather than using the Tab Bar Controller in storyboard, is there a way to do this programatically? Thanks!
The navigation bar that you are seeing on top of the stack is the navigation bar from the UITabBarController itself, that is why you are seeing the back button show "login". There's a few ways to work around this, programmatically:
When you initialize the UITabBarController, set it's navigationController's navigation bar property to "hidden"
Go through each view controller form the beginning of your app up to where you first see this problem and in the "init" method of the viewController you are testing, set the navigationbar to hidden. Something like, self.navigationController?.navigationBar.hidden = true;
This is how you can "debug" this issue, but it's going to take some tweaking to get it right.

Navigation bar button unresponsive in child view controller of UITabBarController

I instantiate my UITabBarController by calling navigationController.viewControllers = #[[self.storyboard instantiateViewControllerWithIdentifier:#"tabController"]];
My Tab bar controller has a child view that is embedded in a navigation controller. However the bar button (item) is unresponsive when I touch them (the buttons in the navigation bar). I have tried logging the action but it appears as if the button is not firing at all.
The only thing that I have done differently is the way i instantiated the tab bar controller. Am I missing something?
I connected the navigation bar button from the storyboard to an action so it is hooked up successfully. Please note there is also a navigation Controller pointing to the UITabbarController not shown below.
The unwanted behaviour maybe because this flow (navigation controller to tabbar controller) is ill advised in the Apple HIG. More information can be found here: Storyboard with NavigationController and TabController. The solution I found was to hide the navigation bar on the navigation controller that links to the navigation bar (can be done in interface builder), then make it reappear in the new navigation controller that the tab bar links to. Confusing I know, I can help anyone who ever has a similar issue.
Is there any specific reason you are doing this:
navigationController.viewControllers = #[[self.storyboard instantiateViewControllerWithIdentifier:#"tabController"]];
You can simply drag an outlet from the UITableViewController to the UINavigationController using only the Storyboard.
I think you forgot to add the navigationItem. In the storyboard, add a navigation Item to your viewController and move your bar button items to the navigation bar that appears on the top.

Resources