3

I have a tab bar controller in storyboard like below:

enter image description here

I have anther storyboard which I would like to use as the content of 1st tab. Let's call it Content.storyboard

What I want to achieve is:

I would like the content of the 1st tab of Tab Bar Controller to be the Content.storyboard.

What I tried is:

I removed the default 1st view controller from Tab Bar Controller storyboard and added a storyboard reference connecting from Tab Bar Controller to Content.storyboard, like below:

enter image description here

The problem is , as you see above, I lost the ability to edit the Tab Item.

So, what is the correct way to achieve what I want? (That's showing a view from another storyboard as content of a tab of TabBarController)

Leem.fin
  • 40,781
  • 83
  • 202
  • 354

3 Answers3

0

I ran into an issue similar to this recently. I ended up moving the navigation controller out of the separate storyboard and into the main storyboard and configured the tab bar items there.

UITabBarController with content provided from another storyboard

EDIT

After some further testing, it looks like the storyboard reference node gets a fake tab bar item. You can't delete it or modify it.

storyboard reference with fake tab bar item

To provide the tab bar item for the other view controller, go into that storyboard and set the view controllers simulated metrics to Translucent tab bar:

bottom bar simulated metrics

Then you can drag in a tab bar item from the object library:

enter image description here

I chose the Bookmarks system icon. you won't see this reflected in the main storyboard, but you will at runtime (and on the child storyboard).

enter image description here

Ben Scheirman
  • 40,531
  • 21
  • 102
  • 137
0

You can achieve this using container view

1) Take Container view in your tab

2) Delete added viewcontroller window (Usually come with container view )

3) Add storyboard Reference

4) Drag from container view to storyboard Reference choose embed option

enter image description here

enter image description here

Prashant Tukadiya
  • 15,838
  • 4
  • 62
  • 98
0

I have also faced the same issue:

Follow the step:

  1. Go to your Content.storyboard
  2. Expand your initial view controller.
  3. then -

enter image description here

  1. After that:

enter image description here

Saurabh Jain
  • 1,688
  • 14
  • 28