Set UITableView’s height to the height of its content with Auto Layout
You have to override updateViewConstraints() in your UIViewController and set the height constraint’s constant to tableView.contentSize.height: override func updateViewConstraints() { tableHeightConstraint.constant = tableView.contentSize.height super.updateViewConstraints() } Then you have to make sure that Label2 has a top constraint that is greaterThanOrEqual to the table view’s bottom. And you also have to change the table view’s height … Read more