添加未在 Xcode 的编辑器菜单中列出的约束
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13982844/
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
Add constraint not listed in Editor menu in Xcode
提问by Sean Danzeiser
I am trying to add layout constraints to my NIB, and i am following the directions apple provides here:
我正在尝试向我的 NIB 添加布局约束,并且我正在遵循苹果在此处提供的说明:
It says this with regards to adding constraints:
它说的是关于添加约束:
To add a constraint Select the object or objects for which you want to add the constraint.
Choose a constraint from the Editor > Add Constraint menu or an alignment type from the Editor > Alignment menu.
添加约束 选择要为其添加约束的一个或多个对象。
从编辑器 > 添加约束菜单中选择约束或从编辑器 > 对齐菜单中选择对齐类型。
That Add Constraint menu is no where to be found. What gives? How can i add constraints??
无处可找到“添加约束”菜单。是什么赋予了?如何添加约束?
回答by Rob
That documentation is incorrect.
该文档不正确。
Constraints are added via the buttons in the lower right corner of the Interface Builder workspace in Xcode 4.6:
约束是通过 Xcode 4.6 中 Interface Builder 工作区右下角的按钮添加的:
The button on the left is for alignment-based constraints, and the middle one (the "I-beam") is for pinning spacing/heights.
左侧的按钮用于基于对齐的约束,中间的按钮(“工字梁”)用于固定间距/高度。
In Xcode 5.0, those buttons look a little different, but the features are very similar:
在 Xcode 5.0 中,这些按钮看起来有点不同,但功能非常相似: