title: iOS: How to dynamically set height of UITableView
body: <p>I have a view controller that contains a table view (see screenshot below). This table view always has exactly 3 rows, and these rows expand when clicked to show more information. How can I make it so that the table view's height always shows exactly these three rows, and no more? As you can see in the screenshot, empty rows with no content are being shown. </p>
  
  <p>Note that the expanded rows may contain views other than UILabels.</p>
  
  <p>Here's how it looks in IB:</p>
  
  <p><img src="https://i.stack.imgur.com/KSx8M.png" alt="enter image description here"></p>