iOS 5:使用 Xcode/Storyboard 在工具栏中定位栏按钮项
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9807855/
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
iOS 5: Positioning Bar Button Item in a toolbar with Xcode/Storyboard
提问by Electro-Bunny
I have an existing toolbar in my View... when I drag a "Bar Button Item" into the tool bar it gets slammed to left side of the toolbar (I would like it to sit on the right edge). Attempting to drag the Bar Button only results in it being "gravity snapped" back to the left side. I see nothing in the size inspector that would allow me to align it to the right edge of the toolbar. The BarButton width can be changed, but seemingly nothing else. Can anyone please give me an idea of how to move it to the right?
我的视图中有一个现有的工具栏......当我将“Bar Button Item”拖入工具栏中时,它会被撞到工具栏的左侧(我希望它位于右侧边缘)。尝试拖动条形按钮只会导致它“重力捕捉”回到左侧。我在尺寸检查器中看不到任何东西可以让我将它与工具栏的右边缘对齐。BarButton 的宽度可以改变,但似乎没有别的。谁能告诉我如何将其向右移动?
I will confess that I have a rookie/rudimentary understanding of (or lack thereof) Xcode/storyboarding gleaned from watching CS193p lecture videos (but I have not been able to relocate the lecture describing positioning within toolbars or pertinent documentation... a link would be welcomed.)
我承认我对从观看 CS193p 讲座视频中收集到的 Xcode/storyboarding 有一个新手/基本了解(或缺乏)(但我无法重新定位描述工具栏或相关文档中定位的讲座......一个链接会欢迎。)
回答by jrturton
Drag in a flexible space
item to the left of your UIBarButton
. Put another one to the right if you want it centered, and so on.
将flexible space
项目拖入UIBarButton
. 如果您希望它居中,请将另一个放在右侧,依此类推。
The pertinent CS193p lecture is lecture 7 (the iPad one), he covers UIToolbar at the start of that.
相关的 CS193p 讲座是第 7 课(iPad 版),他在开头介绍了 UIToolbar。