当我使用autolayout自动调整单元格时
我设置这些:
tableView.estimatedRowHeight = 50
tableView.rowHeight = UITableViewAutomaticDimension
Run Code Online (Sandbox Code Playgroud)
但是当我需要获取表格的contentSize.height时
tableView.reloadData()
tableView.layoutIfNeeded()
print(tableView.contentSize.height)
Run Code Online (Sandbox Code Playgroud)
如果tableView中有三个单元格,并且每个高度为20
tableView.contentSize.height会给我150的高度
但真正的contentSize.height是60
我怎么解决这个问题?