I have the following storyboard with a segue to a storyboard reference:
The problem is that when I run the app, it doesn't show the icon or the title:
These are the item settings:
What am I missing?
To add a tab, first drag a new View Controller object to the storybard. Next control-drag from the tab bar controller to new view controller and select view controllers under Relationship Segue . Your tab bar controller will update with a new tab.
The tab bar interface displays tabs at the bottom of the window for selecting between the different modes and for displaying the views for that mode. This class is generally used as-is, but may also be subclassed. Each tab of a tab bar controller interface is associated with a custom view controller.
Answer: Use self. tabBarController?. tabBar. hidden instead of hidesBottomBarWhenPushed in each view controller to manage whether the view controller should show a tab bar or not.
Here's how to get the tab to show properly:
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With