https://stackoverflow.com/questions/34759302/update-constraints-of-other-elements-when-uitableview-height-change
@IBOutlet weak var tableheight: NSLayoutConstraint!
@IBOutlet weak var displayInvoicetableview: UITableView!
override func viewDidLayoutSubviews()
{
tableheight.constant = self.displayInvoicetableview.contentSize.height
self.view.layoutIfNeeded()
}
-------------------------------------
after reload the table view it may not works then the solution for this in below link
https://stackoverflow.com/questions/32886811/when-is-it-most-appropriate-to-update-uitableview-height-nslayoutconstraint
-------------------------------------
after reload the table view it may not works then the solution for this in below link
https://stackoverflow.com/questions/32886811/when-is-it-most-appropriate-to-update-uitableview-height-nslayoutconstraint