# Mastering Auto Layout - Part 11: Conclusion | Ray Wenderlich

**URL:** <https://forums.kodeco.com/t/mastering-auto-layout-part-11-conclusion-ray-wenderlich/26207>\
**Category:** 🎓 Courses & Articles\
**Created:** [February 14, 2017, 3:12pm UTC](https://forums.kodeco.com/t/mastering-auto-layout-part-11-conclusion-ray-wenderlich/26207 "2017-02-14T15:12:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jerbeers](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jerbeers/32/100211_2.png) [@jerbeers](https://forums.kodeco.com/u/jerbeers)\
**Post date:** [February 14, 2017, 3:12pm UTC](https://forums.kodeco.com/t/mastering-auto-layout-part-11-conclusion-ray-wenderlich/26207/1 "2017-02-14T15:12:11Z")

</div>

Recap what you’ve learned in this Mastering Auto Layout series and check out a few Auto Layout tips as well.

* * *
 This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/3933-mastering-auto-layout/lessons/11](https://www.raywenderlich.com/3933-mastering-auto-layout/lessons/11)

---

<div class="post-metadata">

**Author:** ![jongwonwoo](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jongwonwoo/32/81494_2.png) [@jongwonwoo](https://forums.kodeco.com/u/jongwonwoo)\
**Post date:** [March 16, 2017, 9:34pm UTC](https://forums.kodeco.com/t/mastering-auto-layout-part-11-conclusion-ray-wenderlich/26207/2 "2017-03-16T21:34:37Z")

</div>

These tutorials are very helpful.  
I learned a lot about complicated layout and adaptive layout.  
I will be able to improve the quality of my apps.  
Thanks.

---

<div class="post-metadata">

**Author:** ![jerbeers](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jerbeers/32/100211_2.png) [@jerbeers](https://forums.kodeco.com/u/jerbeers)\
**Post date:** [March 18, 2017, 6:00pm UTC](https://forums.kodeco.com/t/mastering-auto-layout-part-11-conclusion-ray-wenderlich/26207/3 "2017-03-18T18:00:30Z")

</div>

Thanks! Glad they’re helpful.

---

<div class="post-metadata">

**Author:** ![jean-pierre](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jean-pierre/32/81494_2.png) [@jean-pierre](https://forums.kodeco.com/u/jean-pierre)\
**Post date:** [March 24, 2017, 3:47am UTC](https://forums.kodeco.com/t/mastering-auto-layout-part-11-conclusion-ray-wenderlich/26207/4 "2017-03-24T03:47:27Z")

</div>

Good series, I really liked the Debugging and the Adaptive layout environment episodes.Thank you !

I have a question regarding the Size Classes challenge. I tested an alternative way:

1. I embed the starting layout in 2 stack views, one inner for the 2 smaller views, and one outer comprising the green view and the inner stack.
2. Then I vary for traits for regular width, and add a new stack view embedding the grey view and the inner stack view. The new layout is done.
3. However when I click done, and revert to compact width, I notice the stack views are not correctly installed for the traits, my layout for compact width became a real mess!!!

Is vary for traits allergic to multiple embedded stack views? Or is it just me ? (I did it 3 times with the same results)  
What’s your take on that?

---

<div class="post-metadata">

**Author:** ![reddrum](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/reddrum/32/81494_2.png) [@reddrum](https://forums.kodeco.com/u/reddrum)\
**Post date:** [March 26, 2017, 10:23pm UTC](https://forums.kodeco.com/t/mastering-auto-layout-part-11-conclusion-ray-wenderlich/26207/5 "2017-03-26T22:23:11Z")

</div>

Excellent series! Still much to learn about auto layout, but this definitely helps.

---

<div class="post-metadata">

**Author:** ![jerbeers](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jerbeers/32/100211_2.png) [@jerbeers](https://forums.kodeco.com/u/jerbeers)\
**Post date:** [March 27, 2017, 3:11pm UTC](https://forums.kodeco.com/t/mastering-auto-layout-part-11-conclusion-ray-wenderlich/26207/6 "2017-03-27T15:11:23Z")

</div>

> [@jean-pierre](#):
>
> Good series, I really liked the Debugging and the Adaptive layout environment episodes.Thank you !
> 
> I have a question regarding the Size Classes challenge. I tested an alternative way:
> 
> 1. I embed the starting layout in 2 stack views, one inner for the 2 smaller views, and one outer comprising the green view and the inner stack.
> 2. Then I vary for traits for regular width, and add a new stack view embedding the grey view and the inner stack view. The new layout is done.
> 3. However when I click done, and revert to compact width, I notice the stack views are not correctly installed for the traits, my layout for compact width became a real mess!!!
> 
> Is vary for traits allergic to multiple embedded stack views? Or is it just me ? (I did it 3 times with the same results)  
> What’s your take on that?

If you have a sample, I can take a look. I’m not sure, but it sounds like you’re saying the stack view with the gray view is only installed in regular width. I would add all the stack views you want to use as the base layout and only install/uninstall the child views as part of a size class variation.

---

<div class="post-metadata">

**Author:** ![jean-pierre](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jean-pierre/32/81494_2.png) [@jean-pierre](https://forums.kodeco.com/u/jean-pierre)\
**Post date:** [March 27, 2017, 4:09pm UTC](https://forums.kodeco.com/t/mastering-auto-layout-part-11-conclusion-ray-wenderlich/26207/7 "2017-03-27T16:09:40Z")

</div>

Ok, I am going to do it the way you suggest, and I let you know.

---

<div class="post-metadata">

**Author:** ![jean-pierre](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jean-pierre/32/81494_2.png) [@jean-pierre](https://forums.kodeco.com/u/jean-pierre)\
**Post date:** [March 28, 2017, 1:01am UTC](https://forums.kodeco.com/t/mastering-auto-layout-part-11-conclusion-ray-wenderlich/26207/8 "2017-03-28T01:01:12Z")

</div>

Hi Jerry,

I followed your advice and managed to come close. However an interesting challenge came up. I"ll sum it up:

1. I create a very simple layout by embedding 2 rectangular views in a horizontal stack view, fill equally. From left to right: view A, view B. I add the necessary constraints to the stack view. I am in iPhone 7 Plus in portrait. A beauty.

2. Then as you did in your tutorial, I change the orientation to landscape mode , enter the vary for trait mode for width and then I do something crazy: I switch my views’ order inside their stack view. From left to right: view B is now first , then comes view A. I click done. All is fine.

3. I go back to portrait mode, and well I am disappointed: here too, the layout order has changed, it reflects the changes I just made for wR .

How come I cannot create a different position for my views inside a stack view when I vary the width trait?

(Of course, if my 2 views are not embedded in a stack view, the position switching does work fine…)

---

<div class="post-metadata">

**Author:** ![jerbeers](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jerbeers/32/100211_2.png) [@jerbeers](https://forums.kodeco.com/u/jerbeers)\
**Post date:** [March 28, 2017, 2:39pm UTC](https://forums.kodeco.com/t/mastering-auto-layout-part-11-conclusion-ray-wenderlich/26207/9 "2017-03-28T14:39:38Z")

</div>

There are only certain properties that you can vary by size class. In general, it is the properties that have a “+” next to them in IB. For a stack view, the order of the arranged subviews is _not_ one of the properties, but the axis is, for example. So when you’re changing the order of the items in the regular width environment, you’re changing it for all layouts.

---

<div class="post-metadata">

**Author:** ![jean-pierre](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jean-pierre/32/81494_2.png) [@jean-pierre](https://forums.kodeco.com/u/jean-pierre)\
**Post date:** [March 28, 2017, 5:59pm UTC](https://forums.kodeco.com/t/mastering-auto-layout-part-11-conclusion-ray-wenderlich/26207/10 "2017-03-28T17:59:34Z")

</div>

This explains it all. This points us all to the fact that it might not be such a straight business to make a stack view intensive based layout vary by size class. I learned another precious lesson. Thank you!
