title: Same Auto Layout constraints behaving differently in portrait and landscape
body: <p>I was digging into iOS 6.0 new feature Auto Layout, I created a sample app which has one view controller and two UIView as subview.I provided following constraints:</p>
  
  <p><img src="https://i.stack.imgur.com/48Y77.png" alt="Constraint for second view"></p>
  
  <p><img src="https://i.stack.imgur.com/PdHIy.png" alt="Constraint for first view"></p>
  
  <p>When I execute the following app in Landscape mode and rotate it to portrait, it works fine but when I execute it in portrait mode and rotate to Landscape it throws exception:</p>
  
  <pre><code>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;NSAutoresizingMaskLayoutConstraint:0x748cae0 h=--- v=--- H:[UIWindow:0x716a060(768)]&gt;",
      "&lt;NSLayoutConstraint:0x716d980 V:[UIView:0x716d540]-(736)-|   (Names: '|':UIView:0x716d0c0 )&gt;",
      "&lt;NSLayoutConstraint:0x716d8c0 V:|-(20)-[UIView:0x716d540]   (Names: '|':UIView:0x716d0c0 )&gt;",
      "&lt;NSAutoresizingMaskLayoutConstraint:0x7176020 h=-&amp;- v=-&amp;- UIView:0x716d0c0.width == UIWindow:0x716a060.width - 20&gt;"
  )
  
  Will attempt to recover by breaking constraint 
  &lt;NSLayoutConstraint:0x716d980 V:[UIView:0x716d540]-(736)-|   (Names: '|':UIView:0x716d0c0 )&gt;
  
  Break on objc_exception_throw to catch this in the debugger.
  The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in &lt;UIKit/UIView.h&gt; may also be helpful.
  2012-10-22 11:37:37.297 AutoLayoutSample[679: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;NSAutoresizingMaskLayoutConstraint:0x748cae0 h=--- v=--- H:[UIWindow:0x716a060(768)]&gt;",
      "&lt;NSLayoutConstraint:0x716d880 V:[UIView:0x716d230]-(730)-|   (Names: '|':UIView:0x716d0c0 )&gt;",
      "&lt;NSLayoutConstraint:0x716d840 V:|-(20)-[UIView:0x716d230]   (Names: '|':UIView:0x716d0c0 )&gt;",
      "&lt;NSAutoresizingMaskLayoutConstraint:0x7176020 h=-&amp;- v=-&amp;- UIView:0x716d0c0.width == UIWindow:0x716a060.width - 20&gt;"
  )
  
  Will attempt to recover by breaking constraint 
  &lt;NSLayoutConstraint:0x716d880 V:[UIView:0x716d230]-(730)-|   (Names: '|':UIView:0x716d0c0 )&gt;
  
  Break on objc_exception_throw to catch this in the debugger.
  The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in &lt;UIKit/UIView.h&gt; may also be helpful.
  </code></pre>
  
  <p>My question is why it is throwing exception when I execute in portrait mode and rotate to landscape?And why constrains are behaving differently?</p>