I have a TableView in a ScrollView. I set some constraint and auto layout to dynamic cell and dynamic height of table view. But i get some problems with each cell, some of each cell don't show all of content. Any body help?
And auto layout of number in right of information label
Code of table view
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: TableViewCell.identifier, for: indexPath) as! TableViewCell
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
Code for dynamic tableview
override func updateViewConstraints() {
tableHeightConstraint.constant = tableView.contentSize.height
super.updateViewConstraints()
}
I'm stuck fews day. Many thanks.
There are few things you can do here.
layoutIfNeeded()
after setting tableView height constraint