Question

I am creating a tab bar iOS app. The tab bar view controller has two tabs, each of them connected to a view controller.

This how it looks:

enter image description here

I need to add more tabs to the tab controller. I am doing it at the storyboard as follows:

  1. I add a new view controller.
  2. I control-drag from the tab bar controller to the new created view controller.
  3. A window opens and I select Relationship Segue-View Controller.
  4. The segue from the tab bar controller to the new view controller is created.

I think that is the way to do it, but after that the tab bar controller doesn't show any tab icons, the tab bar becomes grey.

Like this:

enter image description here

I need to know what am I doing wrong.

Was it helpful?

Solution

First drag A TabBarController from Object Library you see that only two tabs with thier VC there.

to add more Tab Item in TabBarVC drag VC from Object Library

Then Control drag from TabBarVC to Newly VC then Segue relation pop ups

Select last one Relationship Segue -> View Controllers

Here is the Screen

OTHER TIPS

I had the same problem until I added a tab bar item from the object library into the new view (settings its attributes on the right hand panel) and THEN ctrl dragged from the tab bar controller to the new view, creating a relationship segue.

If I tried to ctrl drag from the tab controller without first adding a tab item to the new view, it had the behaviour you described.

be sure to check the size of your icon image. the tint of image added is grey by default. If you have a large sized tab bar image, it can look like the whole tab bar is greyed out for some reason. pic does not auto resize.

bellow process is follow in Xcode 9.4 for adding new item in tab bar controller. 1)Drag and Drop new Tab Bar Controller into sotrtyboard 2)It will show 2 item which connected with 2 view controller. 3)For adding third item button in tab bar controller i) Add new View Controller. ii) Right click on Tab Bar Controller and Drag into new view controller. iii) one option popup will display inside that popup select "view controllers" options

It will create relationship link and will generate automatic item button in tab bar controller.

need to add/drag icon (from showing the media library) to the 3rd view controller, so that it can display properly.

Restarting Xcode 6.1.1 solved the issue for me while I was working on multiple projects.

go t0 library and choose tabbar controller then drag and drop after that take another uiviewcontroller and then click on tabbar and control and right click then drag and drop in the uiviewcontroller then you see some options where you have to choose in the relationship segue -> view controller

for more clearance see these images

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top