简体   繁体   中英

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? 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

在此处输入图片说明

(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".

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? All the views in the Xib start aligning at the top of the screen, even under the status bar. 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?

you can add top layout guide or bottom layout guide constraint by programmatically very easily & quickly using the KVConstraintExtensionsMaster library refer the links -

Is there any way to add constraint between a view and the top layout guide in a xib file?

Using AutoLayout programmatically for search bar and UITableView

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