Resize TableView Height after
<p>I have a UITableView inside a regular ViewController and I'd like to adjust the tableview's entire height.</p>

<p>I created the tableview through storyboard, and I'm loading data from an API in my <code>ViewDidLoad</code>. I set up the cells in the typical tableview method.</p>

<pre><code>override func viewDidLoad() {
    self.loadPerformers()
    setupTableView(performersTableView)
}

func setupTableView(tableView: UITableView) {
    tableView.dataSource = self
    tableView.delegate = self
    tableView.estimatedRowHeight = 90
    tableView.rowHeight = UITableViewAutomaticDimension
}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {

        if tableView == self.performersTableView {
            let performerCell = tableView.dequeueReusableCellWithIdentifier("PerformerCell", forIndexPath: indexPath) as! PerformersTableViewCell
            let performer = self.performersArray[indexPath.row]
            performerCell.performerPic.image = getPerformerImage(performer.english_name)
            performerCell.performerName.text = performer.english_name + "   " + performer.japanese_name
            cell = performerCell
    }
    return cell!
}

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
    var count:Int?

    tableView.separatorStyle = UITableViewCellSeparatorStyle.None
    tableView.separatorColor = UIColor.clearColor()
    tableView.allowsSelection = false

    if tableView == self.performersTableView {
        count = self.performersArray.count
    }

    return count!

}
</code></pre>

<p>The problem I'm having is the tableview stays the same height after loading the data. Below I'm loading four items, but it's only showing 2. The tableview height doesn't change.</p>

<p><a href="https://i.stack.imgur.com/qSRFg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qSRFg.png" alt="enter image description here"></a></p>

<p>I've tried a few things, among them is changing the height of the tableview frame in the <code>viewWillAppear</code>:</p>

<pre><code>override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(animated)

    let newHeight = self.performersTableView.rowHeight * CGFloat(self.numberOfPerformers)

    self.performersTableView.frame = CGRectMake(performersTableView.frame.origin.x, performersTableView.frame.origin.y,
        performersTableView.frame.size.width, newHeight)
}
</code></pre>

<p>This does nothing though, so I'm misunderstanding something in the rendering process. How do I redisplay the table with my desired height?</p>