I would like to get the size of a UITableView\'s content view when the table is populated. Any suggestions on how to do this?
For table views whose heights are dynamically sized by their cells' contents--
My tableView
is contained in a UIView
, whose updateConstraints()
function looks like this:
override func updateConstraints() {
self.tableView.layoutIfNeeded()
self.tableViewHeight.constant = min(300, self.tableView.contentSize.height)
super.updateConstraints()
}
tableViewHeight
is an IBOutlet
to the XIB-assigned height of the table view. I get whichever is smaller--300 points, or the height of the table view's content size.