简体   繁体   English

Xcode 7中的左约束

[英]Left constraints in Xcode 7

So I'm doing a tut on iOS 9 development with Xcode 7, and in the example I'm currently doing the instruction is adding constraints using ctrl+drag and clicking on a second image. 因此,我正在使用Xcode 7在iOS 9开发上进行测试,并且在当前示例中,我正在使用ctrl + drag并单击第二张图像来添加约束。 Now my issues isn't with that process, my issue is when the video asks me to set left constraints (the right image attached) I don't have that option (the left side of the image attached). 现在,我的问题不在那个过程中,我的问题是,当视频要求我设置左约束(附有右图)时,我没有该选项(附有图的左侧)。 I tried "leading" just to see what it would do and it did not achieve desired results. 我尝试“领导”只是为了看看它会做什么并且没有达到预期的结果。 I'm guessing that this is changed in Xcode 7 and there is a new method of achieving this result? 我猜这在Xcode 7中已更改,并且有实现此结果的新方法吗?

Any help is appreciated, thanks! 任何帮助表示赞赏,谢谢!

EDIT: To update my question as per a suggestion below, here's what's happening. 编辑:按照下面的建议更新我的问题,这是正在发生的事情。 I have a background image view. 我有背景图片视图。 When I am lining up image buttons along the background image, the first one is just fine, once I select the second one, and add the leading constraint, then lock in the width and height in the main constraints - it flies off the page somewhere. 当我沿着背景图像排列图像按钮时,第一个按钮很好,一旦选择第二个按钮,并添加前导约束,然后将宽度和高度锁定在主要约束中-它会飞出页面。 The background image is horizontally and vertically aligned to the container, and the main reason I'm doing this is I have "landscape mode" pulled up in a main preview window and I want to make sure that everything is looking good in that mode. 背景图像与容器水平和垂直对齐,我这样做的主要原因是我在主预览窗口中拉起了“横向模式”,并且我想确保在该模式下一切看起来都很好。

I have tried starting a new project all together and I get the same result. 我尝试一起开始一个新项目,但得到的结果相同。 Again the tutorial I'm following was using Xcode 7 beta, so not sure if that has something to do with it. 同样,我要遵循的教程是使用Xcode 7 beta,因此不确定是否与此有关。 I'd like to lock in on the problem instead of skipping over it in case I run into this in the future. 我想锁定该问题,而不是跳过它,以防将来遇到此问题。

Thanks! 谢谢!

Xcode 7问题

Try using the main constraints menu at the button of Xcode. 尝试使用Xcode按钮上的主约束菜单。

See below screenshot: click the element you want to add a constraints to and it will give you the options you need. 请参见下面的屏幕快照:单击要向其添加约束的元素,它将为您提供所需的选项。

菜单1

菜单2

Cheers, Tal 塔尔干杯

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

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