Use Storyboard References While Retaining Icons & Text for Tab Bar Controller

徘徊边缘 提交于 2019-12-01 15:26:05
VeganKid

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!

Update - This approach no longer appears to work in Xcode 9.

Here's how to get the tab to show properly:

  1. Put the first UIViewController that will be embedded in the tab in the same storyboard as the UITabViewController.

  2. 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.

  3. Select the content view controller.
  4. Click the Editor menu and choose Refactor to Storyboard...

  5. The UITabBarController tab will now point to the new storyboard reference...

  6. ... and the content view controller preserves the UITabBarItem from the tab bar relationship. It will appear normally in the app now.

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! :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!