Change the listing order of the view controllers in Xcode storyboard

后端 未结 8 1468
说谎
说谎 2020-12-14 14:04

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

相关标签:
8条回答
  • 2020-12-14 14:28

    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.

    0 讨论(0)
  • 2020-12-14 14:31

    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.

    0 讨论(0)
  • 2020-12-14 14:31

    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.

    0 讨论(0)
  • 2020-12-14 14:41

    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!

    0 讨论(0)
  • 2020-12-14 14:41

    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

    0 讨论(0)
  • 2020-12-14 14:43

    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.

    0 讨论(0)
提交回复
热议问题