kodeco.com Forums

Video Tutorial: Intro to Auto Layout Part 4: Constraint Relations & Priorities

Learn about constraint priorities, the problems they solve, and the power they bring to your layout.

This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3201-auto-layout/lessons/5

Thank you Jerry,

I’m enjoying the tutorial, excellent and clear …

quick curiosity: on this challenge I noticed that after selecting all 8 txtFields and going to the align (add new alignment constraints) menu, check box for leading edge gives me “add 7 constraints” and checking “horizontal in container” gives me “add 8 constraints” . We might expect minus one element from the selection if we are aligning to the top element, but should not leading and trailing edges assign a constraint to all eight txtFields?

Is this normal behaviour? Do I have an Xcode problem? Have you treated this question before?

Thank for your time, and for the tutorials.

Yeah, the constraints that are between two sibling views, like leading, trailing, horizontal centers will behave differently than the constraints between a view and its container. Maybe the best way to think of it is, in the case of constraints made with the container, there are 9 views involved, so it’s still creating n-1 constraints. Does that make sense?

Thank you , yes. ( do I really have to use the heart button?)

The double-length pseudo language does not show for me when I go into “Preview”. Any thoughts as to why?

Thank you for the very informative videos you guys do one heck of a job explaining the mysteries of auto layout.

Thanks for the kind words.

I’ve seen what you’re talking about in cases where “Use Base Internationalization” is not checked. If you go to your project settings, on the “Info” tab, under “Localizations”, there is a checkbox. If that’s not checked, the language option won’t show.

Hi. I’ve opened challenge finish folder and run app on 6s plus and it’s bad looks, textfield are different

Yeah, the best way to solve constraints where you want the spacing to be equal is using UILayoutGuide, which is covered in tutorial 7.