Xcode 4 - IB - 均匀分布控件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5927761/
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
Xcode 4 - IB - evenly distribute controls?
提问by Graham Perks
In Interface Builder I have a bunch of text fields that sit vertically. I want them evenly distributed in the vertical space, and all to be identically sized.
在 Interface Builder 中,我有一堆垂直放置的文本字段。我希望它们均匀地分布在垂直空间中,并且所有尺寸都相同。
I've found the Alignment menu that lets you line up items. I can't find a menu for distribution or sizing. Does Xcode 4 include those layout commands?
我找到了可以让您排列项目的对齐菜单。我找不到分发或调整大小的菜单。Xcode 4 是否包含这些布局命令?
采纳答案by McWolfe
The boring answer is to type in the coordinates manually. Not very smooth, but it gives you exact control over the placement at least (in the Size inspector).
无聊的答案是手动输入坐标。不是很流畅,但它至少可以让您精确控制位置(在尺寸检查器中)。
回答by Alex Gray
The answer is, NO. And I HATEhaving to be "one of those people" that has to tell you so. I assumewhat you are looking for is something similar to OmniGraffle's quintessential feature, "Canvas, Grid, Alignment". It is THE TOOL that makes OG so damned good.
答案是,不。我讨厌必须成为必须告诉你的“那些人之一”。我假设您正在寻找类似于 OmniGraffle 的典型功能“画布、网格、对齐”的东西。正是这个工具让 OG 如此出色。
It amazes / disgusts me that a company worth $100 billion is unable to get this basic tenet of visual layout right, when a company writing software for that same idiotic company's own platform for years, has had this down for as long as I can remember. The Xcode team needs to pull it together. For example, KVO Bindings are, and have always been a joke - a not so funny one - that are impossible to implement, plug-ins are gone… And IMHO, Lion auto-layout is Unusable. They need some NEW PEOPLE or something, maybe that aren't developers, or something.. Cause Xcode is getting harder to use, not easier. It looks better, and is better organized… but its obvious that there is no "big thinker" inside that group that is willing to question their fragile and awkward paradigms.
让我感到惊讶/厌恶的是,一家价值 1000 亿美元的公司无法正确地实现视觉布局的这一基本原则,当一家公司为同一个愚蠢的公司自己的平台编写软件多年时,从我记事起就一直在这样做。Xcode 团队需要将其整合在一起。例如,KVO 绑定是,并且一直是一个笑话 - 一个不太有趣的笑话 - 无法实现,插件消失了......恕我直言,Lion 自动布局无法使用。他们需要一些新人或其他东西,也许不是开发人员,或者其他东西.. 因为 Xcode 越来越难使用,而不是更容易。它看起来更好,而且组织得更好……但很明显,在那个群体中没有愿意质疑他们脆弱而笨拙的范式的“大思想家”。
Are they kidding with this? How about this Xcode? _Shut up, line up the buttons, distribute then evenly - like 99% of people are going to want, 99% of the time - and dont puke meaningless lines all over everything?__ And what the hellis Content Hugging Priority
and Content Compression Resistance Priority
? I read the docs twice and still have NO IDEA what those are or how to use them. I'm no Einstein, but If I can't "get it" after making a concerted effort… It's too hard. lol. Ok, I need to go mark futile rant off my to-do list, now.
他们这是在开玩笑吗?这个Xcode怎么样?_Shut起来,排队的按钮,然后均匀地分布-就像99%的人会想,时间99% -并且不要呕吐无意义线遍布一切__然后呢?这到底是Content Hugging Priority
和Content Compression Resistance Priority
?我阅读了两次文档,但仍然不知道它们是什么或如何使用它们。我不是爱因斯坦,但如果我齐心协力还不能“得到”……那就太难了。哈哈。好的,我现在需要在我的待办事项清单上标记无用的咆哮。
回答by Fábio Oliveira
Hope this helps: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/AutoLayoutbyExample/AutoLayoutbyExample.html
希望这会有所帮助:https: //developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/AutoLayoutbyExample/AutoLayoutbyExample.html
The concept is to use some spacer views and set them to be all the same size. There are some tricks with the priorities to be done so please follow the link for a definite answer.
这个概念是使用一些间隔视图并将它们设置为相同的大小。有一些技巧需要优先处理,所以请点击链接以获得明确的答案。