简体   繁体   English

iOS 7 AutoLayout“顶部到顶部布局指南”是否在Interface Builder中没有控制拖动?

[英]iOS 7 AutoLayout “Top Space to Top Layout Guide” Without Control-Drag in Interface Builder?

I cannot use control-drag with the mouse often due to our development environment (sharing screens and pair programming). 由于我们的开发环境(共享屏幕和结对编程),我经常无法使用鼠标进行控制拖动。

For iOS 7 Auto Layout, how can one do a "top space to top layout guide" without control-drag in interface-builder? 对于iOS 7自动版式,如何在不进行界面生成器控件拖动的情况下进行“顶部到顶部的布局指南”? I don't see that option in the menus. 我在菜单中没有看到该选项。 The closest thing I see is "Editor / Pin / Top Space To Superview" option which is not what I want. 我看到的最接近的东西是“编辑器/固定/超级视图的顶部空间”选项,这不是我想要的。 The IDE is XCode 5.1.1 IDE是XCode 5.1.1

在此处输入图片说明

(If you solve this, this will make things much better when Pair Programming and screen sharing which we do all the time. It would be great!) (如果您解决了这个问题,那么当我们一直在进行配对编程和屏幕共享时,这将使事情变得更好。那太好了!)

You can use the "nearest neighbour" popover in the bottom. 您可以在底部使用“最近的邻居”弹出框。 Select the top line and click "Add 1 constraint". 选择顶行,然后单击“添加1个约束”。

This will default your constraint to the top layout guide as shown in the second screenshot below. 这会将您的约束默认为顶部布局指南,如下面的第二个屏幕截图所示。

在此处输入图片说明

在此处输入图片说明

Any way to do this in Xib, without using a storyboard? 有什么办法可以在Xib中做到这一点,而无需使用情节提要? All the views in the Xib start aligning at the top of the screen, even under the status bar. Xib中的所有视图即使在状态栏下也开始在屏幕顶部对齐。 I woul like them to start below the status bar. 我希望他们从状态栏下面开始。 I know I could use constraints to do this in every Xib file separately, but isn't there a nicer way? 我知道我可以使用约束在每个Xib文件中单独执行此操作,但是没有更好的方法吗?

you can add top layout guide or bottom layout guide constraint by programmatically very easily & quickly using the KVConstraintExtensionsMaster library refer the links - 您可以使用KVConstraintExtensionsMaster库以编程方式非常轻松快捷地添加top layout guidebottom layout guide约束,请参见链接-

Is there any way to add constraint between a view and the top layout guide in a xib file? 有什么方法可以在视图和xib文件中的顶部布局指南之间添加约束?

Using AutoLayout programmatically for search bar and UITableView 以编程方式将AutoLayout用于搜索栏和UITableView

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

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