3
votes

I have created segues in the following way:

  • view controller VC1 is the root view controller
  • a segue from view controller from VC1 to VC2

In Xcode there is a section that shows the navigation controller scene (as shown in the attachment)

screen shot of the navigation controller scene, pls see the red rectangle

The navigation controller scene shows in the following order:

  • VC2
  • Navigation controller
  • VC1

Question:

Though everything works as expected, I would like to change the order in which the navigation controller scene is displayed

The order of the navigation controller doesn't reflect the way the segues are connected

Is there a way to manually change the order without having to delete the view controllers and recreating them (pls see the attached pic) ?

1
I can't understand what you mean by changing the way the navigation controller scene is displayed. Do you just want to change the order in IB or does this situation have a consequence in code?fbernardo
You don't need to recreate.But you have to do little work.You just have to "select that VC2 + press cmd + drag and drop to the end and connect it. And delete that old VC2 which is at first.Dinesh Raja
@R.A thanks a lot I tried command drag but didn't seem to work but while doing so, I realized that copy and pasting the controller works like a charm and then just had to delete the old view controlleruser1046037
@fbernardo I wanted to change the order in IB and not in code. It is almost like wanting to change the order of some .h / .m files in the project navigator. Anyways copying and pasting the view controller does the trick and then deleting the old view controller. The only thing is, need to recreate the segue which wasn't much effortuser1046037

1 Answers

2
votes

Open your storyboard file with a text editor (it's XML) and find something like , then you should see:

<!--VC1-->
   <scene sceneID="...">
        ....
   </scene>
<!--Navigation Controller-->
   <scene sceneID="..">
        ....
   </scene>

Just change the order ^^

EDIT:

By "change the order" I mean mean rearrange the entire block, be careful to not mess up your file.