Swift unable to add tab bar to tab bar view controller? Grayed out? - ios

Ok, my experience with tab bar controllers is limited but Ive never encountered this issue. I am able to create a tab bar controller but not add a tab bar or tab bar item tp it. I have followed this : https://makeapppie.com/2015/01/27/tab-bar-controllers-in-storyboards/ and others exactly and they just say to drag in the tab bar controller or embed another VC in it and boom - tab bar.
This is what has happened for me:
The tab bar is grayed out and Im not able to drag a tab bar onto the VC or anywhere. What am I doing wrong here? I need to migrate my standalone VCs into a tab bar controller.

make sure to your relationships between view controllers and view controller
this is my tabbarcontroller

Related

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.

How to Add a Bar Button Item on a Disappeared Navigation Bar using Storyboard?

I want to add a bar button item on the navigation bar. (Say View 1 here.) The view that will segue to View 1 is embedded in a navigation controller.
However, the navigation bar is not showing in this view.
If I use attribute inspector to add a opaque/ translucent navigation bar, there will be a navigation bar in View 1. But if I drag in a bar button item, it cannot be shown in the storyboard. Though the bar button is in the document outline, it cannot be shown on the storyboard. Also, if I run the application, it is not on the screen.
When running the application in the simulator, View 1 will have a navigation bar on the top of it, since I use "Show" rather than "Show Details" to show View 1. I tried to embed View 1 in a navigation controller again, but it won't help much.
Can anyone tell me how to add a bar button in this situation using storyboard? And why the navigation bar is missing from the storyboard?
Thanks in advance.
I figure it out by myself.
Drag a Navigation Item from the object list, and then add bar button item to it.
Thanks to rdelmar for his idea, though drag out a navigation bar won't work in the way I thought it should work.
In my situation, View 1 is a table view. Drag a navigation bar to the view will cause it to be the header view for the table, rather than a navigation bar I had expected. Then there will be two navigation bar in the view when I run the application.
Of course we can drag out a navigation bar and add a button to it, it might work different with your expectation. As I had said, it might leads to a view which contains two navigation bars.
You can fix this by drag out the Navigation Item (contains the bar button you had added) inside the Navigation Bar out. In my situation, I drag it out and put it the same level with the table view inside the document outline. Then it won't become the header view for the table view.
After that, we can just delete the navigation bar from the document outline.
I have no idea why the navigation bar disappears in my storyboard. If anyone has some idea for this, please let me know.
It sounds like you're adding the navigation bar by using the Simulated Metrics. If so, this doesn't add one at run time, it's only for layout purposes in IB. You should drag out a navigation bar from the objects list, and add your button to it.

SWRevealViewController hides tab bar controller

I am using SWRevealViewController and tab bar view controller. A table view is hooked to the back of the tab bar. If I select any of the cells,the view transitions to the correct view but my tab bar buttons disappear. This is the hierarchy of the views:
SWRevealViewController - > SideTableViewController - > tab bar controller >tab 1
Not sure what is going on. Please help. Thanks!
I had a similar problem when using SWRevealViewController. What I believe is happening is that you are linking to one of the individual TabBar Views, instead of linking it to the TabBarViewController. But, without a picture of your storyboard, I can't be 100% sure

tab bar goes when going between views

I am developing a tabbed bar application using storyboards.
I am attempting to put in a back button one a view - but when I press to go back (from one view to another) the tab bar vanishes.
How can I ensure the tab bar stays there?
Just make sure you're adding the UITabBar to the main Navigation Controller or View Controller of Navigation Hierarchy.
You need to select Tab Bar on the Navigation Controller Bottom Bar under the Attributes Inspector, then set the bottom bar to Inferred for the rest of your pages (or Tab Bar if you want it to be different on any pages)

Resources