ios 在 StoryBoard 中重新排列标签栏控制器顺序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12662700/
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
Rearranging Tab Bar Controller Order in StoryBoard
提问by BigLex
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!
在我的应用程序 iPhone 应用程序中,我有一个标签栏控制器,它与 4 个不同的表视图控制器有 4 种关系。有没有办法以图形方式重新排列 StoryBoard 中关系的顺序?我找不到办法做到这一点,而且我确定我一定遗漏了一些东西!
回答by abitofcode
In 4.5 save the storyboard after adding a Controller, switch to another file and then back to the Storyboard and the tab dragging should work again.
在 4.5 添加控制器后保存故事板,切换到另一个文件,然后回到故事板,标签拖动应该再次起作用。
回答by Indy Bains
You can just re-arrange the order by dragging and dropping the icons in the tab bar controller
您可以通过拖放标签栏控制器中的图标来重新排列顺序
回答by Nicola
I was not able to drag&drop with XCode 4.6 (with any of mentioned cobination). I have solved it opening the storybord in "Source Code" mode, locating the tabBarControllerand rearranging the sequetag.
我无法使用 XCode 4.6(使用任何提到的组合)进行拖放。我已经解决了它在打开的“storybord源代码”模式,定位tabBarController和重新排列塞克标签。
回答by Jannie Theunissen
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.
我知道 OP 正在使用 Xcode 界面构建器并要求以图形方式执行此操作,但对于使用 Xamarin iOS 设计器的开发人员,这是我使用的解决方法。
Open the .storyboard file in a text editor or using Xcode, right click on the storyboard item in Project Navigator and select Open AsSource Code. In the storyboard XML locate the <tabBarController ...>
node. Then I rearrange the order of the segues in the <connections>
section:
在文本编辑器中或使用 Xcode 打开 .storyboard 文件,右键单击 Project Navigator 中的 storyboard 项目并选择Open AsSource Code。在情节提要 XML 中找到该<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>
Search for the destination=
attribute value in the XML to determine which view controller the segue element is pointing at.
destination=
在 XML 中搜索属性值以确定 segue 元素指向哪个视图控制器。
回答by handsome
SHIFT + DRAGworks on Xcode 10.0
SHIFT + DRAG适用于 Xcode 10.0
回答by Fogmeister
Just drag and drop the tab icons in the tab bar.
只需在选项卡栏中拖放选项卡图标即可。
i.e. the main tab bar that belongs to the tab bar controller.
即属于标签栏控制器的主标签栏。
HTH
HTH
::EDIT:: So this doesn't seem to work... I'm sure it used to.
::EDIT:: 所以这似乎不起作用......我相信它曾经如此。
Anyway, the easiest way I found is to remove the tabs and add them back in the order you want them to show.
无论如何,我发现最简单的方法是删除选项卡并按照您希望它们显示的顺序重新添加它们。
Hope this helps.
希望这可以帮助。
回答by bryfox
As noted in comments, drag & drop doesn't currently work (Xcode 4.5) after adding a navigation controller. However, restarting Xcodeafter adding the controller seems to get drag & drop working again.
如评论中所述,添加导航控制器后,拖放当前不起作用(Xcode 4.5)。但是,在添加控制器后重新启动 Xcode似乎可以再次进行拖放操作。
回答by Tom DeMille
If you open the storyboard as 'source code view' and then close it an open it as IB view it seems to fix the bug..
如果您将故事板作为“源代码视图”打开,然后将其关闭并将其作为 IB 视图打开,它似乎可以修复该错误。
回答by Gerald
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
添加到大家提供的拖放方法。我将此作为答案发布,以便我可以包含图像。在 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
如果您使用的是 custom tab bar item
,即使Tab Bar Controller
场景显示灰色条,您仍然可以拖放以重新排序,即使该条项目仍然存在。当您的所有栏项目都是自定义项目时,这尤其不显眼
回答by Aaban Tariq Murtaza
XCODE 10.1: Zoom the story board. Simply drag tab items. (No shift no other)
XCODE 10.1:缩放故事板。只需拖动选项卡项目。(没有移位没有其他)