Change the listing order of the view controllers in Xcode storyboard

IosXcodeXcode4Uistoryboard

Ios Problem Overview


I'm just starting my first application using storyboards. I'm using Xcode 4.5 and iOS 6 SDK. I want to know how to change the order in which the controllers are listed in the Document Outline (panel to the left of the storyboard).enter image description here

Ios Solutions


Solution 1 - Ios

In Latest Xcode 13 you can manually reorder storyboard scenes. Just drag&drop in the left pane.

Old answer

In Xcode 11 you just open storyboard XML and move specific "scene" to proper place under "scenes" tag. And that's it. The order will correspond to Document outline.

Solution 2 - Ios

In Xcode 5, the order of the view controllers/scenes listed in the storyboard's "Document Outline" seems to be determined by an alphanumeric sorting of the sceneID attribute values in the storyboard XML file.

After upgrading to Xcode 5 from 4.6 the Document Outline seemed to list my scenes in a random order. I inspected the Storyboard XML file (right click on storyboard file -> Open As -> Source Code) but the order of the scenes was correct. After further investigation I realized the sceneID attribute values were the issue. I found each sceneID attribute and added an alphanumerically increasing prefix to the value. For example, for the first scene that should appear in the Document Outline I prefixed its sceneID value with a "1a", for the second "1b", for the third "1c" and so on. After doing that for all my scenes, they had a proper listing order in the Document Outline.

I think the sceneID values are probably only used for unique identification/ordering purposes, so hopefully changing them doesn't cause other unexpected problems. But I'm still able to work with the storyboard in Interface Builder without problems and my app seems to work normally. So if this problem is irritating you as much as it did me, you might consider this workaround until Apple gives us a proper solution... just be sure to make a backup first!

Solution 3 - Ios

In the Document Outline, drag the orange view controller icon. As you do this you will see the blue horizontal insertion point appear between the grey boxes. Let go and the whole grey group box for the view controller will relocate.

Solution 4 - Ios

At least for Xcode 4.6 , the scenes are in the order they're stored in the storyboard xml.

So you can open it with a text editor and reorder the tags to you liking, and start Xcode.

Solution 5 - Ios

I am not sure if it is still meaningfull for you. As of xcode 6.1 you can rightclick your storyboard file, choose "Open as..." -> "Source code" and change the order of view controllers rearranging sections order. I can't move them by drag'n'dropping view controller icons for unknown reason, so it is the only way that works for me.

Solution 6 - Ios

For Xcode 5.1.1, you have to change the order of tag segue. Open the storyboard as source code (Right Click -> Open As -> Source code)

<segue destination="Bdn-Z8-Ql8" kind="relationship" relationship="viewControllers" id="0DS-1d-02F"/>
<segue destination="KY3-Z9-s1u" kind="relationship" relationship="viewControllers" id="u45-Ly-JkB"/>
<segue destination="k72-nP-MyV" kind="relationship" relationship="viewControllers" id="TAj-be-l8p"/>
<segue destination="gcA-x5-8Iw" kind="relationship" relationship="viewControllers" id="B7T-js-1Vs"/>

Changing the order of the above lines will change order of ViewControllers

Solution 7 - Ios

It seems that the view controllers belong to the tab bar controller, so the order of the buttons determine the order not the position of the view controllers on the screen. You should be able to drag and drop the buttons.

Solution 8 - Ios

Just Drag and Drop the icon on the bottom in your first View Controller Screen. Xcode 11.6

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDarrenView Question on Stackoverflow
Solution 1 - IosViktor KuceraView Answer on Stackoverflow
Solution 2 - IosDentonView Answer on Stackoverflow
Solution 3 - Iosobj-DView Answer on Stackoverflow
Solution 4 - IosSonicBisonView Answer on Stackoverflow
Solution 5 - IosMaxim BerezovskyView Answer on Stackoverflow
Solution 6 - IosThai TranView Answer on Stackoverflow
Solution 7 - IosCthutuView Answer on Stackoverflow
Solution 8 - IosJean LuizView Answer on Stackoverflow