Xcode 5 - 故事板 - 没有限制
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18911986/
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 5 - Storyboard - Has no constraints
提问by Ardavan Kalhori
Does anyone know why I get the following message:
有谁知道为什么我收到以下消息:
"The selected views have no constraints. At build time explicit left, top, width, and height constraints will be generated for the view."
“选定的视图没有约束。在构建时,将为视图生成明确的左、上、宽和高约束。”
I'm using XCode 5 - Storyboard with AutoLayout turned on
我正在使用 XCode 5 - 故事板与 AutoLayout 打开
回答by Ardavan Kalhori
Found the solution!
找到了解决办法!
Select the ViewController then from the XCode menu:
然后从 XCode 菜单中选择 ViewController:
Editor --> Resolve Auto Layout issues --> Add missing constraints in View Controller
编辑器 --> 解决自动布局问题 --> 在视图控制器中添加缺少的约束
回答by Adrian
It appears that in Xcode 5.1 when using AutoLayout, when you create a new scene it will start without any editable constraints. They are generated at runtime to reflect the scene's intended layout.
看起来在 Xcode 5.1 中使用 AutoLayout 时,当您创建一个新场景时,它将在没有任何可编辑约束的情况下启动。它们在运行时生成以反映场景的预期布局。
So adding constraints in interface builder is not needed only if you wish to modify the defaults. When you do that you need to familiarize yourself with the provided tools (as seen in the "Resolve auto layout Issues" menu)
因此,仅当您希望修改默认值时,才需要在界面构建器中添加约束。当您这样做时,您需要熟悉提供的工具(如“解决自动布局问题”菜单中所示)
In a ideal wold layout just works without thinking to constraints, even if they work behind the scenes. It seems to me a step towards that goal. This is not to start a debate if the goal can be reached, only to say that we can expect more similar interface builder / xcode changes to follow.
在理想的世界布局中,即使他们在幕后工作,也不会考虑约束条件。在我看来,这似乎是朝着这个目标迈出的一步。这不是要开始争论是否可以达到目标,只是说我们可以期待更多类似的界面构建器/xcode 更改。
回答by user3643412
You have selected auto layout on your viewcontroller , so you can't set the contraints manually , uncheck the layout , it will show the constraints automatically .
您在视图控制器上选择了自动布局,因此您无法手动设置约束,取消选中布局,它将自动显示约束。