ios 如何使用 Storyboard 重新排列 UITabBarController 项目?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11796208/
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-08-30 19:34:55  来源:igfitidea点击:

How can I rearrange UITabBarController items using the Storyboard?

iosiphonexcodestoryboard

提问by itsjavi

Hi I have a UITabBarController in XCode 4.5 as the root controller with many tabs I need to change the order to.

嗨,我在 XCode 4.5 中有一个 UITabBarController 作为根控制器,其中包含许多选项卡,我需要将顺序更改为。

The only thing that works for me is remove the relationships and add them again in the desired order that I want the tabbar items to appear.

唯一对我有用的是删除关系并按照我希望标签栏项目出现的所需顺序再次添加它们。

Is there another way to do this?

有没有另一种方法可以做到这一点?

thanks

谢谢

回答by MobileMon

In the storyboard highlight the tab bar controller.

在故事板中突出显示标签栏控制器。

Make sure you are zoomed in enough and that a blue box is around the tab bar controller.

确保放大到足够大,并且标签栏控制器周围有一个蓝色框。

Then click on the tabs and drag them around to where you want them

然后单击选项卡并将它们拖动到您想要的位置

回答by Gustaf Carleson

I solved this by right-clicking on the storyboard -> open as source code, and then rearranged the "segue" xml-blocks in the order I wanted them to be.

我通过右键单击情节提要 -> 作为源代码打开来解决这个问题,然后按照我希望的顺序重新排列“segue”xml 块。

回答by jimmyb

xcode 4.5, drag and drop failed. as suggested by another, close xcode and restart xcode. after this drag and drop of tabBarItems worked perfectly to rearrange order.

xcode 4.5,拖放失败。正如另一个人所建议的那样,关闭 xcode 并重新启动 xcode。在此拖放 tabBarItems 后,可以完美地重新排列顺序。

回答by Mark

I could not drag and tabs around while i had the tab bar controller as root view of navigation controller. I had to delete the navigation controller and restart xcode (4.5.2)

当我将标签栏控制器作为导航控制器的根视图时,我无法拖动和标签。我不得不删除导航控制器并重新启动 xcode (4.5.2)

回答by Reinhard M?nner

Some of the suggestions above worked for me sometimes, but not always. Even rebooting the Mac did not help.
The only way I found that works always is deleting all segues from the tab bar controller to its child view controllers, and reconnecting them in the right order.

上面的一些建议有时对我有用,但并非总是如此。即使重新启动 Mac 也无济于事。
我发现始终有效的唯一方法是从选项卡栏控制器到其子视图控制器中删除所有 segue,并以正确的顺序重新连接它们。

回答by Jannie Theunissen

When working with Xamarin iOS Designer, I open the .storyboard file in a text editor and locate the <tabBarController ...>node. Then I rearrange the order of the segues in the <connections>section:

使用 Xamarin iOS Designer 时,我在文本编辑器中打开 .storyboard 文件并找到<tabBarController ...>节点。然后我重新排列部分中的segue的顺序<connections>

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

回答by PJR

1)Make sure you are zoomed in enough and that a blue box is around the tab bar controller.

1)确保放大到足够大,并且标签栏控制器周围有一个蓝色框。

2)Then click on the tabs and drag them around to where you want them.

2)然后单击选项卡并将它们拖动到您想要的位置。

3)if it is not working , just click on any .h or .m file and then go to storyboard file and try.

3)如果它不起作用,只需单击任何 .h 或 .m 文件,然后转到故事板文件并尝试。

4)even though it is not working , just restart xcod and try it.

4)即使它不起作用,只需重新启动xcod并尝试即可。

回答by zeeawan

Click and drag worked for me with Xcode 6.2 with the correct zoom level.

单击并拖动适用于具有正确缩放级别的 Xcode 6.2。

enter image description here

在此处输入图片说明

回答by Bart?omiej Semańczyk

Using Xcode 5 and above you should just drag and drop them:

使用 Xcode 5 及更高版本,您只需拖放它们:

enter image description here

在此处输入图片说明