如何在 xcode 4.5 的初始视图的标签栏控制器中重新排序 segues?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12597870/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 01:38:37  来源:igfitidea点击:

How to re-order segues in initial view's tabbar controller in xcode 4.5?

iosxcodeuitabbarcontrollerstoryboarduitabbar

提问by iamtoc

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?

如何重新排序初始视图的 tabbar 控制器元素,而不必删除所有 segue 并按照所需顺序手动重新连接它们?有没有办法在它们连接后改变它们的顺序?

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.

我可以通过在 xcode 4.4 中拖动它们来做到这一点,但该选项在 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?

例如,我如何将“主页”项目移动到第一个位置?

回答by Tiago Almeida

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.

在您的示例中,只需在 Tab Bar Controller 中选择 Home 并将其拖动到第一个位置。

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).

如果您在拖放时遇到问题,请尝试先选择您的 Tab View Controller 或退出您的 XCode 并再次打开它(如@thepumpkin1979 和@Rick 指出的)。

回答by smoothBlue

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

重新排列 tabBar 图标/项目只需编辑 xml 文件,它就会工作。

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

单击您的“故事板”,然后单击“编辑器”中 3 个按钮的最右侧。

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

这将在左侧显示一个 xml 文件,您可以随意编辑该文件。

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.

在该文件中,您应该看到 xml 标签“tabBar”,里面是“items”,里面是“tabBarItem”。您的所有 tabBar 项目都将被列出。您可以按照您希望的顺序剪切和粘贴它们。

I just did it now in Xcode 4.5.2.

我刚刚在 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.

附言。我是 iOS 新手,所以我不能使用所有正确的 Xcode 名称。

回答by user1263865

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

我认为您可以控制+拖动选项卡项来重新排序。

回答by Amr Angry

Drag and drop should work

拖放应该可以工作

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

您可以将栏 Item 向左拖动以从故事板重新排列其位置。