I have got TableView
in the MainstoryBoard
and the number of rows is random every time.
I want the height of the whole TableView
to be fl
Simply take outlet for tableview height constraint and update it in willDisplay cell: UITableViewCell
method of UITableView
@IBOutlet weak var tblHConstraint: NSLayoutConstraint!
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
self.tblHConstraint.constant = self.tblView.contentSize.height
}