title: UIView height not adjusting to subview heights in UITableView header
body: <p>I have a UITableView with a header view and a custom row. The header view height is not adjusting properly to the constrained heights of its subviews.</p>
  
  <p>The header view container view has the following subviews with constrained heights:</p>
  
  <ul>
  <li>View <strong>(this height should compute to 188 but is 128 instead)</strong>
  
  <ul>
  <li>Map: UIImage (height = 128)</li>
  <li>View: UIView (height = 60)</li>
  </ul></li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/WWiC3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WWiC3.png" alt="enter image description here"></a></p>
  
  <p>The header view height should be computed at Map Height + View Height = 128 + 60 = 188 as shown in Storyboard. However running this in the simulator squishes the header view to 128 like this:</p>
  
  <p><a href="https://i.stack.imgur.com/JWVAU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JWVAU.png" alt="enter image description here"></a></p>
  
  <p>Further inspection shows the header view height is 128 and not 188 as expected:</p>
  
  <p><a href="https://i.stack.imgur.com/m7D2w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/m7D2w.png" alt="enter image description here"></a></p>
  
  <p>Also the Debug area shows a constraint conflict which shows the header view height is trying to be 128 which conflicts with the heights of its subviews. As a result it squishes the map height:</p>
  
  <pre><code>2015-11-27 16:58:46.415 MyApp[3387:52799] 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:0x7fcb5acf1270 h=--&amp; v=--&amp; V:[UIView:0x7fcb5c246620(128)]&gt;",
      "&lt;NSLayoutConstraint:0x7fcb5c24c440 V:[Stop Details Container]-(0)-|   (Names: Stop Details Container:0x7fcb5c24c490, '|':UIView:0x7fcb5c246620 )&gt;",
      "&lt;NSLayoutConstraint:0x7fcb5c24c6f0 V:[Map]-(0)-[Stop Details Container]   (Names: Stop Details Container:0x7fcb5c24c490, Map:0x7fcb5c24aa10 )&gt;",
      "&lt;NSLayoutConstraint:0x7fcb5c24c830 V:|-(0)-[Map]   (Names: Map:0x7fcb5c24aa10, '|':UIView:0x7fcb5c246620 )&gt;",
      "&lt;NSLayoutConstraint:0x7fcb5c24c880 V:[Map(128)]   (Names: Map:0x7fcb5c24aa10 )&gt;",
      "&lt;NSLayoutConstraint:0x7fcb5c24c8d0 V:[Stop Details Container(60)]   (Names: Stop Details Container:0x7fcb5c24c490 )&gt;"
  )
  
  Will attempt to recover by breaking constraint 
  &lt;NSLayoutConstraint:0x7fcb5c24c880 V:[Map(128)]   (Names: Map:0x7fcb5c24aa10 )&gt;
  
  Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints 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>How can I have the header view height properly compute to the heights of its subviews?</p>