Tab bar icon and title not showing with Storyboard References
Solution 1
Here's how to get the tab to show properly:
- Put the first UIViewController that will be embedded in the tab in
the same storyboard as the UITabViewController.
- Ctrl + Drag from the tab bar controller to the content view
controller to make the connection as per usual. This will
automatically add the UITabBarItem to the bottom of the content view
controller.
- Select the content view controller.
- Click the Editor menu and choose Refactor to Storyboard...
The UITabBarController tab will now point to the new storyboard reference...
... and the content view controller preserves the UITabBarItem from the tab bar relationship. It will appear normally in the app now.
Solution 2
You can modify image/title of the tab bar item in the initial view controller of the storyboard you are referring to. You just need to add a 'tab bar item' to the initial view controller and change its properties (title/image) accordingly.
- Outline view of the root view controller in the referred storyboard
- The modified tab bar item in the view controller
Note: the change will not be reflected on the tab bar in the main storyboard; you only see it in the referred storyboard and at runtime.
Solution 3
The problem is that in the target view controller, you don't have a UITabBarItem in the views hierarchy. The TabBarItem is related to the storyboard reference, but should be related to the View Controller.
Looks like a "bug" in Xcode...
To resolve this you can do the following:
- Just create the segues from the UITabBarController to the Storyboard references.
- You may configure the Tab Bar Items in the storyboard references, they don't do much more other than showing the tabs in the tab bar on the Storyboard, which is nice for development purposes.
If you now run the app, you will indeed notice that the tabs are missing. To get the tabs to display in the running app as well, do this:
- Go to the viewcontroller the storyboard reference is referencing to
- Add a Tab Bar Item into this View Controller by dragging it from the Object Library into the View Controller
- You will now see a tab bar with one single tab in the view controller
- Configure the tab bar item to show the correct title and icon
Now run the app and you will now see your tabs.
Solution 4
I tried adding another tab bar, then added tab bar item, selected and image for it BUT Non of above seemed to work with my case ..
it was like this :
Then i compared it with VC that were working properly with TabBar icons..
later i found that my navigation items and tab bar items were not together :
Now its working :):)
Solution 5
After struggling with this problem for a few days I found this solution. Double click the storyboard link, which will open the referenced storyboard. In the scene navigator, you can edit the bar item with a custom title and icon. Works in xCode 9.