简体   繁体   English

Xcode 5-故事板-无限制

[英]Xcode 5 - Storyboard - Has no constraints

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." “所选视图没有约束。在构建时,将为该视图生成显式的左,上,宽和高约束。”

XCode 5-故事板-自动布局-无约束

I'm using XCode 5 - Storyboard with AutoLayout turned on 我正在使用XCode 5-启用自动版式的情节提要

Found the solution! 找到了解决方案!

Select the ViewController then from the XCode menu: 选择ViewController,然后从XCode菜单中:

Editor --> Resolve Auto Layout issues --> Add missing constraints in View Controller 编辑器->解决自动布局问题->在View Controller中添加缺少的约束

It appears that in Xcode 5.1 when using AutoLayout, when you create a new scene it will start without any editable constraints. 看起来在Xcode 5.1中使用AutoLayout时,创建新场景时,它将在没有任何可编辑约束的情况下开始。 They are generated at runtime to reflect the scene's intended layout. 它们在运行时生成,以反映场景的预期布局。

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更改随之而来。

您已经在视图控制器上选择了自动布局,因此您不能手动设置约束,取消选中布局将会自动显示约束。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM