简体   繁体   中英

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

Found the solution!

Select the ViewController then from the XCode menu:

Editor --> Resolve Auto Layout issues --> Add missing constraints in 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. 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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