Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reordering view controllers in a UITabBarController, all defined in a Storyboard

I'd like to change the order of view controllers attached to a UITabBarController, within my Storyboard, without disconnecting all view controllers and reconnecting them in the desired order.

My Question: Can this be done just via the Storyboard IB UI?

Discussion

I'm looking for some inspector panel where I can move items up and down in that list of view controllers that feeds the viewControllers property on UITabBarController.

several view controllers linked to tab bar controller

I've got a lot of tabs and so I'm hoping to not have to disconnect everything and reconnect, just to change the order.

I even tried changing the 'tag' value on the Bar Item, in the inspector, but that value was also ignored at runtime (I believe it is for identification purposes, not for ordering).

Tag set on Bar Item

like image 585
idStar Avatar asked Jul 02 '12 22:07

idStar


People also ask

How do I move the view controller in storyboard?

You should drag the white bar above the View Controller (the bar that contains the First Responder). It works even on low zoom levels!

How do I change the order of tab bar items?

Naming the Tab Bar Items If you want to change the order of the Tab Bar Items in the Tar Bar Controller, drag the item and drop it into the order you want.


2 Answers

enter image description here

you can simply drag and drop and resort them with the mouse in the storyboard. it still works in 4.5.1

EDIT

maybe you have first to switch the storyboard view to "Source Code" and go back before you can drag. right-click the storyboard file and select "Open as" -> "Source Code" and then back again "Open as" -> "Interface Builder - iOS Storyboard". that should do the trick.

EDIT

Does not work in Xcode 4.5.2 anymore for me!

EDIT

In Xcode 5 preview 5 it works again. Seems that Apple did fix this bug in the new verion

enter image description here

like image 169
rockstarberlin Avatar answered Sep 28 '22 22:09

rockstarberlin


If drag-n-drop not working, there is another workaround. In Storyboard I just removed all the relationships from the UITabBarController and reconnected them in the right order.

like image 45
brooNo Avatar answered Sep 28 '22 22:09

brooNo