Xcode 5 - Storyboard - Has no constraints

随声附和 提交于 2019-12-18 11:47:02

问题


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


回答1:


Found the solution!

Select the ViewController then from the XCode menu:

Editor --> Resolve Auto Layout issues --> Add missing constraints in View Controller




回答2:


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.




回答3:


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 .



来源:https://stackoverflow.com/questions/18911986/xcode-5-storyboard-has-no-constraints

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!