Use Storyboard References While Retaining Icons & Text for Tab Bar Controller
First, in the storyboard where the tab bar controller is, there should be a scene for the referenced storyboard.
Just click on the scene that tab is associated with and click the tab bar at the bottom, then go to the attributes inspector, and you'll be able to assign a new icon to it.
It seems another solution that worked for me without altering the Approach you went through:
- Leave Storyboard references as it's
- Go to Initial view controller in the referenced storyboard
- Add Tab bar item to the scene
- Configure it as you have done in UITabBarController storyboard
- Clean & Run
- Repeat it for all Storyboard references
Happy Coding!
For some weird reason, I wasn't able to see the tab bar in my reference view controller in IB. Although while selecting it and expanding the Document Outline, I was able to see it in my view list. I could make my changes through it.
Hope this helps! :)
Update - This approach no longer appears to work in Xcode 9.
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.