khaliq khaliq - 2 months ago 6
iOS Question

How to add a Table View Controller to a tab based application Xcode 4.3.3

So I initially started with the tab-based application template for iOS 5.
I've got a tab bar hooked up to two views, but when I go to add a Table View Controller to the firstviewcontroller, It won't let me.

I'm a little confused on how I should tackle this? Do I have to do it with code? Or is there a way I can graphically do this?
enter image description here

Answer

View embedding in Storyboards isn't straightforward.

First, delete First View Controller:

Storyboard without First View Controller

Now, drag a new Table View Controller onto the storyboard:

Storyboard with Table View Controller

Finally, create a relationship between Tab Bar Controller and the new Table View Controller.

Select the Tab Bar Controller and then while pressing the Control key, drag your mouse over to the Table View Controller and let go with your mouse. In the popup box, select Relationship - View Controllers

enter image description here

And now the new Table View Controller should be a tab within the original Tab Bar Controller.

enter image description here

Comments