Trying to add 3rd tab to tabBarController
Asked Answered
S

5

48

I'm trying to add a 3rd tab to the tabBarController using ios5. The standard object you get when you drag it out to your storyboard has 2 tabs. Does anyone know how to do this? I searched the internet and all examples start with their tabBarController with the extra tabs without showing how to get it.

Scutum answered 7/4, 2012 at 13:22 Comment(0)
H
8

for third tab first add a view controller and then right click the tabview controller and then from it's storyboard segway from relation controll drag to the added view controller and it's done

Heartless answered 7/4, 2012 at 13:38 Comment(1)
Thanks! I control dragged to the new TVC and it just showed up!Scutum
B
111

Here is the video I watched that taught me how to add a third tab to a TabBarController:

I will summarize the process below.

Create a new Tabbed Application project

enter image description here

This will automatically provide two tabs that already "just work".

enter image description here

Add new View Controller

Drag another view controller onto the storyboard.

enter image description here

Add Tab Bar Item

Drag a Tab Bar Item onto the new View Controller that you just added.

enter image description here

Connect to Tab View Controller

Click and Control-Drag from the Tab View Controller to your new View Controller. A menu will pop up. Choose the view controllers option under the Relationship Segue group.

enter image description here

That's it. You should be able to run it now and have all three tabs work. Watch the video that I linked to for more details.

Note:

  • To do anything on your new tab, don't forget to add a new View Controller class (as you would for any new View Controller).
Brim answered 28/9, 2015 at 5:54 Comment(2)
It is almost 2018 and people like me are still searching for how to do it. Sometimes I am baffled by how basic things are not explained properly by official docs or online courses.Albur
I'm glad this has been such a helpful question. The thing with this type of development is that it's a very visual type of development, with the dragging from the side, etc. Back when I asked the question, there weren't any visual answers of how to do anything at all. I'm glad that @Brim and others are able to post the pictures of how to do this as well and it's helpful to everyone.Scutum
C
42

Based on Wolvorin and Tom van responses, and based on what I have experienced you should do as following:

  1. Create an empty View Controller (in Controllers and Objects)
  2. From Windows and Bars, drag Tab Bar Item to the newly added view
  3. From the main View Controller, select Tab Bar Controller icon (next to First Responder), and Control-Drag to the newly added View
  4. BOOM you have new tab
Chianti answered 4/11, 2012 at 15:59 Comment(0)
A
17

To expound on @Roozbeh 's answer, when you control drag from the Tab Bar Controller to the newly added view controller, make sure you select the view controller option under Relationship Seque

Control drag from here

And select view controllers under Relationship Seque

I was reading this question after having the same problem and I wanted to clarify what the exact step was.

Abney answered 5/4, 2014 at 15:43 Comment(1)
this should be top answer, by far the simplest method, thanks manSherlynsherm
H
8

for third tab first add a view controller and then right click the tabview controller and then from it's storyboard segway from relation controll drag to the added view controller and it's done

Heartless answered 7/4, 2012 at 13:38 Comment(1)
Thanks! I control dragged to the new TVC and it just showed up!Scutum
Q
1

Look in the right part of the screen, I believe it's the Objects library view. Just find the "Tab Item" (or something) and drag it into the bar.

Quince answered 7/4, 2012 at 13:26 Comment(1)
Thanks for responding to this. I found out that I could drag from my tab bar controller to my table view controller (or maybe it was the navigation controller) and the 3rd tab just "magically" appears.Scutum

© 2022 - 2024 — McMap. All rights reserved.