I started refactoring one of my projects to make the code easier to manage and the Tab Bar Controller lost its icons for which tab represents what. Without this I'm a bit lost which tab is what for re-ordering purposes.
How do I get the icons to show up again for a tab bar controller when I'm using storyboard references?
Refer to my attached image. Notice how the first 3 tabs are 'blank' but the other tabs that I have not refactored yet show with the icons and titles.
For those unfamiliar with storyboard references I was following the tutorial here: http://code.tutsplus.com/tutorials/ios-9-staying-organized-with-storyboard-references--cms-24226
Sample of Tasks Storyboard to show Icon set Correctly
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.
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.
来源:https://stackoverflow.com/questions/37241684/use-storyboard-references-while-retaining-icons-text-for-tab-bar-controller