title: AutoLayout to keep view sizes proportional
body: <p>I'm trying to achieve the following:</p>
  
  <ul>
  <li>I have 2 views in my xib that need to stay 20 pixels off the edge (both sides and top)</li>
  <li>The 2 views that need to resize aren't the same size</li>
  <li>They have to be 20 pixels apart</li>
  <li>Their width needs to stay relative to the width of the parent view</li>
  </ul>
  
  <p>I read a tutorial about doing just that and it works but the problem with it is that it requires both views to have the same width and pin <code>Widths equally</code>, which I don't want.</p>
  
  <p>Here's what I tried:</p>
  
  <ul>
  <li>Add leading space constraint to left view to be 20 pixels</li>
  <li>Add top space constraint to left view to be 20 pixels</li>
  <li>Add top space constraint to right view to be 20 pixels</li>
  <li>Add tailing space constraint to right view to be 20 pixels</li>
  <li>Add horizontal spacing constraint to both views to be 20 pixels</li>
  </ul>
  
  <p>The problem I'm running into is that the left view doesn't resize and the right view fills out the space to keep the 20 pixels horizontal space.</p>
  
  <p>Is there a way I can get both views to resize proportionally to the space they should be filling?</p>
  
  <p>Here are the screenshots of my layout and constraints:</p>
  
  <p><img src="https://i.stack.imgur.com/TFSFE.png" alt="xib Layout"><img src="https://i.stack.imgur.com/ibtak.png" alt="Constraints definitions"></p>
  
  <p>Thanks!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I get the following warning when I try to rotate my device:</p>
  
  <pre><code>2012-10-11 08:59:00.435 AutolayoutTest[35672:c07] Unable to simultaneously satisfy constraints.
      Probably at least one of the constraints in the following list is one you don't want.
      Try this: (1) look at each constraint and try to figure out which you don't expect;
      (2) find the code that added the unwanted constraint or constraints and fix it. (Note:  
      If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
  (
      "&lt;NSLayoutConstraint:0x8a6b2b0 H:[UIView:0x8a6b1d0(170)]&gt;",
      "&lt;NSLayoutConstraint:0x8a68ad0 H:[UIView:0x8a69430(90)]&gt;",
      "&lt;NSLayoutConstraint:0x8a6ba40 H:[UIView:0x8a69430]-(20)-[UIView:0x8a6b1d0]&gt;",
      "&lt;NSLayoutConstraint:0x8a6ba00 H:[UIView:0x8a6b1d0]-(20)-|   (Names: '|':UIView:0x8a6b7e0 )&gt;",
      "&lt;NSLayoutConstraint:0x8a6b940 H:|-(20)-[UIView:0x8a69430]   (Names: '|':UIView:0x8a6b7e0 )&gt;",
      "&lt;NSAutoresizingMaskLayoutConstraint:0x7199aa0 h=--&amp; v=--&amp; V:[UIView:0x8a6b7e0(568)]&gt;"
  )
  
  Will attempt to recover by breaking constraint 
  &lt;NSLayoutConstraint:0x8a6b2b0 H:[UIView:0x8a6b1d0(170)]&gt;
  </code></pre>