Is there a way I can continue watching the previous version of this series?. I was watching ‘Intro to Auto Layout Part 7: UILayoutGuide and NSLayoutAnchor’, but now I can’t find it here. Thank you for the update but I really want finish what I started.
Hey guys! Good point, hadn’t considered the case where people were in the middle of the old series :]
I’ve re-listed them on the site temporarily; please finish watching when you can, we’ll probably be taking them down again in a few weeks to prevent people from stumbling upon the old courses instead of the new/shiny/updated one. I hope that helps! :]
Thanks for the course and tying the concepts together. It’s been very confusing to say the least. Can you clarify one last thing… It looked like the direction was moving towards adaptive layout. Now I see the tutorials are gone on it, and I’m not sure I even see it in Xcode. Could you briefly describe it, and when you would use it over auto layout? This is a big learning and time investment. I would rather refactor my apps to the correct techniques then finding out there was a preferred way after the fact.
Good question. The old series on Adaptive Layout is back temporarily and the “Mastering Auto Layout” series that is coming soon will explain it also, but generally speaking adaptive layout builds on top of auto layout, so you can start there and then add support for size classes (the core concept of adaptive layout). Auto layout will handle the minor adjustments between screen sizes and different environments, and then adaptive layout will handle the major changes between environments.
I do see your new tutorial and the old adaptive layout tutorial. I have an app that’s been released and I used constraints for the whole thing. Your Auto Layout tutorial really clarifies many of the things I could have done to make things easier. I’ll watch it again or maybe more for the finer points, and then it’s off to refactoring for me! Thanks for the excellent work.
I’m currently working on Beginning Auto Layout and the copyright label doesn’t
center on any devices larger than the iPhone 7 using the suggested constraints.
It appears to center on the iPhone 7 but if you display the label on an iPhone 7 plus or
larger device, it’s off center to the left.
It works on all devices if I do the following:
If I select the “Align” icon and choose “align horizontally”.
Select the “Add new constraints” icon and choose the bottom spacing to
nearest neighbor (20) and choose “width” and “height” and add 3 constraints,
then the label text centers at the bottom on every device.
I also did an “Auto Shrink” of the text and scaled it to 0.5.
The challenge with labels is that it can be hard to see what their actual frame is. The suggested constraints will cause the label to stretch the full width of the device (minus some spacing on each side). If you set the alignment of the label to centered, the text will be centered in the label - which is the full width of the device. But if the alignment is left at the default, left alignment, then the label will stretch on larger devices, but the text won’t move from its spot on the left.
I went back and looked at the label and realized that I hadn’t selected “center alignment” in the attributes
inspector. By selecting “center alignment” and following your steps, it now works and aligns properly on all devices.
I’m finding that you have to be careful about adding constraints because you can end up adding more
constraints then you need to correct constraints you didn’t need in the first place!
Also, is this the proper place to post any and all questions about this video course?