title: Dynamic UIView height with auto layout in iOS 6
body: <p>For the last couple of days I am trying to accomplish a fairly simple (at least it should be) layout using auto layout constraints, but without success.</p>
  
  <p><em>My view hierarchy is:</em><br>
  UIScrollView<br>
  -- UIView (Container view)<br>
  -----UILabel (Multirow label)<br>
  -----UIWebView<br>
  -----UILabel<br>
  -----UIButton</p>
  
  <p><img src="https://i.stack.imgur.com/uuLwF.png" alt="View hierarchy in IB"></p>
  
  <p>The desired functionallity is the Container view to be expanding according to the size of the contents. In order to increase the height of the UIWebView I use the following code:</p>
  
  <pre><code>- (void)webViewDidFinishLoad:(UIWebView *)webView {
      [self.webView sizeToFit];
  } 
  </code></pre>
  
  <p>I tried many different constraints, with the most reasonable ones being:<br>
  1. Pin top space from superview for the 1st label (Event Title)<br>
  2. Pin vertical spacing for the 1st label and the UIWebView<br>
  3. Pin vertical spacing for the rest elements (i.e. UIWebView - UILabel (Event Date) and UILabel (Event Date) - UIButton)<br>
  4. The container view has low priority (1) bottom vertical space constraint with its superview</p>
  
  <p>The result I get is the following:
  <img src="https://i.stack.imgur.com/7iR3z.png" alt="enter image description here"></p>
  
  <p>The UIWebView expands but does not push down the event date label and the button, plus the Container view does not expand either.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>You may download the sample Xcode project <a href="http://nsloom.com/downloads/AutoLayoutDemo.zip" rel="noreferrer">from here.</a></p>