Reputation: 10794
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?
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
.
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).
Upvotes: 37
Views: 13784
Reputation: 1853
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
Upvotes: 93
Reputation: 789
I've been having this problem in Xcode 4.6.3, but just discovered a way to reorder my tabs. Not sure if this applies to everybody, but in the navigation menu on the left side of the storyboard, if I expand the TabBarController it reveals the Tab Bar element. Once I've clicked on the Tab Bar, I am then able to drag and drop the tab icons in interface builder the way I would expect to.
Upvotes: 3
Reputation: 4740
After I added a new view controller, Xcode 4.6.2 wouldn't let me reorder tabs either. Simply clicking on one of my source code files, then clicking back on the storyboard file does the trick and I can edit the tab order again.
Upvotes: 1
Reputation: 21
You can rearrange by going to Source Code view and find the scene and edit the source. You can find the tab bar segue and add the code. (right-click on the storyboard in the project navigator and choose Open As...Source Code) Then go back to Storyboard Nib view (right-click on the storyboard in the project navigator and choose Open As...Interface Builder-IOS Storyboard)
Upvotes: 1
Reputation: 506
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.
Upvotes: 16
Reputation: 1686
XCode 4.5.1
Not an empirical answer but I had the same problem..
I opened the storyboard as Source Code, reordered the
Then opened the storyboard as Interface Builder - iOS Storyboard
Nothing changed... but
I could then drag and drop the tabs
Upvotes: 9
Reputation: 131
I had the same issue. If I putted a new View Controller or new Navigation Controller in storyboard, drag and drop did not work in tab bar controller. I closed and reopened Xcode and drag and drop worked well another time.
Upvotes: 3