Kodeco Forums

Auto Layout Tutorial in iOS 9 Part 1: Getting Started

Learn the basics of auto layout in part 1 of this auto layout tutorial, fully up-to-date for iOS 9.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1564-auto-layout-tutorial-in-ios-9-part-1-getting-started
1 Like

This is really a nice tutorial. But i am confuse at one point. When to use drag and when use pin or align to add constraints?

Hi, alamin5433. Like I understood the drag & the pin are almost the same, you decide yourself what to use. What about the align, You use it just when you want to align a couple of controls…

Oh my god! Thank you so much for this clear and nice tutorial…
you totally helped me!

hi, there is a mistake in the text I think:

-Do you want the button to be attached to the left (should be right) edge of the screen at a distance of 254 points? In that case you need to make the existing Horizontal Space constraint 234 points bigger. That’s what the orange badge with “+234” means.
-Do you want the button to be attached to the right (should be left) edge of the screen instead? Then you need to remove the existing constraint and create a new one.

UUUOOOOUUU… The great tutor !
Many thanks for it. I owe you one, mate.
You could help me.
This is the great tutor , READ IT!

Thank you indeed for upgrading this tutorial to iOS 9. It´s fabulous !

Bradley… I’ve gone through Part 1 and 2. Finally, finally, finally, I understand Auto Layout!!! Thank you!

@bpj823 Great tutorial, thanks a lot for this. : )

I have a problem, i got this working right from Assistant Editor, but when i run the app in a simulator or device, this is not keeping the auto layout setting : / , and it is keeping iphone layout on ipap device : /. Why ?

From Assistant Editor it is perfect keeping auto layout view and resizing well.

Hi Bradley, thanks for the very informative tutorial.

I see that when I set leading & trailing constraints, a value of zero does not actually bring it to the left & right edges of the device. Similarly if top constraint is zero it also is not to the edge of the device. However for bottom it does look like it does goes to the very edge of the device.

Is there a way at run-time to determine what is the measurement of that extra bit of margin is at the top, left & right? It looks like it is 20 pixels but I want to determine that definitively at run-time. How can I do that? Thanks

This is one Awesome Tutorial. To the point, Very precise & Covers almost every basic for Auto Layout.
Thanks Man!!!

Great Tutorial!!! Thanks a lot for making auto layouts soo easy :slight_smile: