21

How do I reorder the initial view's tabbar controller elements without having to delete all the segues and re connect them manually in the desired order? Is there a way to change the order of these after they have been hooked up?

I was able to do this by just dragging them around in xcode 4.4 but that option seems to be non available in xcode 4.5.

Hopefully, this is possible from within the storyboard mode. But if it's only possible programmatically, that's ok too, just looking for any proper way to accomplish this without having to delete them all and re hook them up. enter image description here

For example, how would I move the 'Home' item to first position?

iamtoc
  • 1,569
  • 4
  • 17
  • 24
  • For some reason, it just started working after 3 days. No idea why, but now I can reorder them with drag and drop. So problem solved. ??? – iamtoc Sep 26 '12 at 08:54
  • 5
    Seems like a bug, I encountered the same problem. It will work only after I save and exit Xcode and restart Xcode again. – Rick Sep 27 '12 at 03:17
  • Same experience here, I had to restart xcode in order to reorder the items. – David K Apr 09 '13 at 18:29
  • 3
    in my experience i don't have to restart xcode i just have to save storyboard then i just have to click on other file of the project (e.g. AppDelegate.h) then when i go back to storyboard i can drag and drop tab items to rearrange – gilsaints88 Apr 10 '13 at 01:53

4 Answers4

49

The positions in each view are associated with the positions on the bottom bar of the Tab Bar Controller. If you reorder that bar you will reorder your views. You can reorder them by drag and drop on your interface builder.

In your example just select Home in your Tab Bar Controller and drag it to the first position.

If you have problems dragging and dropping try to select first your Tab View Controller or exit your XCode and open it again (like @thepumpkin1979 and @Rick pointed out).

Tiago Almeida
  • 14,081
  • 3
  • 67
  • 82
  • 1
    That was precisely my problem, I wasn't selecting the view controller prior to my attempt to move it. Always the little things. – iamtoc Sep 26 '12 at 09:21
  • 4
    like @Rick pointed out, sometimes you need to close and re-open the project to get this working (`XCode 4.5.2`) – bithavoc Nov 05 '12 at 03:40
  • @thepumpkin1979 Added in my answer. Thanks for the extra solution :) – Tiago Almeida Nov 05 '12 at 10:31
  • I have tried all the things mentioned above to no avail in 4.5.2. iamto - you mention selecting the view controller prior to your attempt to move it - I've tried that as well. Each time, it attempts to grab the entire Tab Bar Controller. This used to be easy, but for the life of me, I can't do a simple drag and drop on the Tab Bar Navigation anymore. – user1563057 Nov 09 '12 at 19:31
  • Using XCode 4.5.2 and having this problem as well. Sometimes I'm able to drag it and sometimes not. It's frustrating. I ended up reconnecting the tabs in the correct order. – Jay Q. Nov 26 '12 at 13:02
8

Re-arrange tabBar icons/itemsJust edit the xml file and it will work.

Click on your "storyboard" and click the most right of the 3 buttons in "Editor".

This will show up an xml file on the left which u can edit anyway you wish.

Inside that file you should see xml tag "tabBar", inside it is "items", inside this is "tabBarItem". All your tabBar items will be listed. You may cut and paste them in the order you wish.

I just did it now in Xcode 4.5.2.

Hope it also works for you too.

Ps. I am new to iOS so I can't use all the right Xcode names.

smoothBlue
  • 203
  • 4
  • 12
6

I think you can control+drag the tab item to reorder.

user1263865
  • 121
  • 1
  • 4
  • 2
    You Are Amazing! This worked like a charm. Just a tip.. You hold control to start the move then you release it before releasing the drag to drop it. – Shannon Cole Jun 05 '13 at 05:05
0

Drag and drop should work

You can drag the bar Item to the left to rearrange its position from the Storyboard.

Amr Angry
  • 3,711
  • 1
  • 45
  • 37