title: Swift 3 - UITableView is cut off in UIScrollView
body: <p>i have a problem with my tableview which is in a scrollview. The table is cut off at the end. </p>
  
  <p><a href="https://i.stack.imgur.com/QZyPl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QZyPl.png" alt="cut off"></a></p>
  
  <p>This is my storyboard (scrolling is disabled for the table). The button is just a placeholder for some content in my real app:</p>
  
  <p><a href="https://i.stack.imgur.com/pKBGu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pKBGu.png" alt="storyboard"></a></p>
  
  <p>This is the table-class (I know its from the question from yesterday I just can't figure the problem out):</p>
  
  <pre><code>class Table: UITableView, UITableViewDataSource, UITableViewDelegate{
  
      let sections: [String] = ["Section 1", "Section 2", "Section 3"]
      let s1Data: [String] = ["Row 1", "Row 2", "Row 3"]
      let s2Data: [String] = ["Row 1", "Row 2", "Row 3"]
      let s3Data: [String] = ["Row 1", "Row 2", "Row 3"]
  
      var sectionData: [Int: [String]] = [:]
  
      override func awakeFromNib() {
          super.awakeFromNib()
  
          delegate = self
          dataSource = self
  
          register(UINib(nibName: "Cell", bundle: nil), forCellReuseIdentifier: "Cell")
  
          sectionData = [0:s1Data, 1:s2Data, 2:s3Data]
  
          rowHeight = UITableViewAutomaticDimension
          estimatedRowHeight = 96.0
  
      }
  
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int)
          -&gt; Int {
              return (sectionData[section]?.count)!
      }
  
      func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int)
          -&gt; String? {
              return sections[section]
      }
  
      func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
          return sections.count
      }
  
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
          var cell = tableView.dequeueReusableCell(withIdentifier: "Cell")
  
          return cell!
  
      }
  
  }
  </code></pre>
  
  <p>The cell itself has a height of 340 and in the table should be three of them.</p>
  
  <p>The ViewController has a constraint to the height of the table and the table itself. I read something about this solution on stackoverflow. When I set a breakpoint at the constraint-constant-set the height is about 1000 so this is correct at this point.:</p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
  
      @IBOutlet weak var tableHeight: NSLayoutConstraint!
      @IBOutlet weak var table: Table!
  
      override func viewDidLoad() { 
          super.viewDidLoad()  
      }
  
      override func viewDidAppear(_ animated: Bool) {
          super.viewDidAppear(animated)
          tableHeight.constant = table.contentSize.height
      }
  
  }
  </code></pre>
  
  <p>I tried different suggestions how to get rid of the probelm. But somehow I miss something. Has someone maybe an advice for me. </p>