title: iOS - Different stackviews for size classes
body: <p>I'm using <code>UIStackView</code> for layouting in one of my tableview cell xibs to make resizing easier, and I'm also using size classes as there are layout differences between phones and tablets.</p>
  
  <p>Due to some reason, I have to use a different stackview for each size class. Say <code>stackview1</code> for iPhones and <code>stackview2</code> for iPads. Now I have moved <code>label1</code> into <code>stackview1</code> in iPhone size class, switched to iPad size class and wanted to move <code>label1</code> to <code>stackview2</code> from <code>stackview1</code>(which is greyed out). But once I do this and switch back to iPhone size class, <code>Label1</code> is moved out of <code>stackview1</code> and the iPhone layout screws up.</p>
  
  <p>Wondering if anyone has encountered this before and got any solutions?</p>
  
  <p><strong>UPDATED</strong></p>
  
  <p>To clarify further, </p>
  
  <ol>
  <li><p>I implemented the following two layouts purely via constraints and I was convinced by by colleagues that layout using UIStackView can be easier to adapt to UI changes. For example, in the layouts below, there is a distance constraint (12) between <code>label1</code> and <code>label3</code>, if I want <code>label3</code> to move up once <code>label1</code> and <code>label2</code> are hidden/nil, I will have to manually set the distance constraint to 0. While if via <code>UIStackView</code>, set <code>label1</code> and <code>label2</code> as hidden and we are all set. This is just an example, there are much more changes like this.</p></li>
  <li><p>The reason why I need different <code>UIStackView</code> for sizes class is because of the design differences.</p></li>
  </ol>
  
  <p><strong>Phone Layout</strong>
  <a href="https://i.stack.imgur.com/uqySo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uqySo.png" alt="iPhone Layout"></a>
  <strong>Tablet Layout</strong>
  <a href="https://i.stack.imgur.com/FonY2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FonY2.png" alt="iPad Layout"></a></p>