[英]Xcode 6.3 Storyboard Autolayout Constraints
This is my storyboard: 这是我的故事板:
This is the iPad Simulator: 这是iPad模拟器:
For the constraints I go to the bottom right and click on the button that has a triangle with two extruding bars (it sort of looks like a star wars fighter with a triangle as the cockpit). 对于约束,我转到右下角,然后单击带有带有两个突出条的三角形的按钮(它看起来像是一个以三角形为驾驶舱的星球大战战士)。 I scroll down to the section that says all view in view controller I click on clear constraints. 我向下滚动到显示视图控制器中所有视图的部分,然后单击明确的约束。 Then I go back to the same button but this time I click add missing constraints. 然后,我回到同一按钮,但是这次单击添加缺少的约束。
Why is this happening? 为什么会这样呢? How can I fix it? 我该如何解决?
Adding missing constraints doesn't mean "add the constraint I think will look better in my project". 添加缺少的约束并不意味着“添加我认为在我的项目中看起来会更好的约束”。 Xcode adds some constraints to keep everything in place, but this may (or may not) be what you want. Xcode添加了一些约束以使所有内容保持不变,但这可能是(或可能不是)您想要的。
To paint a control in place without ambiguity your need at least 4 constraint, two on each axe (two for X, two for Y). 为了在不模糊的情况下绘制控件,您需要至少4个约束,每个轴上两个(两个X,Y两个)。 I recommend to clear all constraints, and start control by control, adding constraints. 我建议清除所有约束,并开始按控件进行控制,添加约束。
Some tips: 一些技巧:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.