In my app iPhone app I have a Tab Bar Controller with 4 relationships to 4 different Table View Controllers. Is there a way to rearrange the order of the relationship in the StoryBoard graphically? I can't find a way to do this and I'm sure I must be missing something!
19 Answers
I know the OP is using Xcode interface builder and asking for a graphical way to do this, but for developers working with Xamarin iOS Designer, here is a workaround that I use.
Open the .storyboard file in a text editor or using Xcode, right click on the storyboard item in Project Navigator and select Open As Source Code. In the storyboard XML locate the <tabBarController ...>
node. Then I rearrange the order of the segues in the <connections>
section:
<connections>
<segue destination="274" kind="relationship" relationship="viewControllers" id="286"/>
<segue id="943" destination="910" kind="relationship" relationship="viewControllers"/>
<segue destination="147" kind="relationship" relationship="viewControllers" id="159"/>
</connections>
Search for the destination=
attribute value in the XML to determine which view controller the segue element is pointing at.
To add on to the drag and drop method provided by everyone. I posted this as an answer so that I can include images. Tried on Xcode 7.3
If you are using custom tab bar item
, you can still drag and drop to reorder even though the Tab Bar Controller
scene shows a grey bar, the bar item is still there. This is especially inconspicuous when all your bar item are custom items
I'm using XCode 5.1 for development of iOS 7.1 and I found the following approach works for rearranging the tabs in a Tab Bar Controller.
To rearrange the tabs in a Tab Bar Controller, delete the segues from the Tab Bar Controller to your sub-view controllers. Then re-draw the segues in the order you want the tabs. To "re-draw" I mean you control drag from the Tab Bar Controller to the sub-view controller and select Relationship Segue (at bottom of list) => view controllers.
Same thing is in xCode 4.6. I originally was following tutorial on beginning storyboards in ios At the point to swith the item on TabBarController, I could't change the order. I tried to save it - didn't work; however, Once I closed the XCode and open again - it DID WORK.
For me dragging did not work either in XCode 7.3.1. Restarting XCode did not help. And none of the above mentioned solutions worked for me.
What helped me: I deleted the relationship to the second item and ctrl-dragged from that item to the Tab Bar Controller and created another relationship. It was automatically in the second place now.