1

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

enter image description here

(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!)

finneycanhelp
  • 9,018
  • 12
  • 53
  • 77
  • Can you not right click and drag? – Fogmeister Jul 24 '14 at 11:24
  • From my point of view - you can blame me for not answering your question.If you want to use autolayout in your app, stop doing that in Inteface Builder. If you're working on your own project(1 person), it's ok. At the moment when you start to use some repository system ( Git, SVN, etc..) you'll recognize, that your xib file will be updated with new changes every time you open it even though you didn't change anything. To make it more funnier. If you'll try to add a new view in your xib, all your constraints ( your work ) get lost and you can start defining your constraints from beginning. – deathhorse Jul 24 '14 at 12:19

3 Answers3

3

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.

enter image description here

enter image description here

John Grant
  • 1,679
  • 10
  • 8
1

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?

User123335511231
  • 11,654
  • 4
  • 18
  • 22
0

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

Community
  • 1
  • 1
keshav vishwkarma
  • 1,832
  • 13
  • 20