[英]Autolayout uitableview auto height
You have to change the tableview height according to your data count.Here 5 animals name ,so 5 * each cell height ,give to table view height then it works. 您必须根据数据计数更改表格视图的高度。这里有5个动物的名字,所以每个单元格的高度为5 *,赋予表格视图的高度即可。 In your view ,height of tableview not enough to show all details.
在您看来,tableview的高度不足以显示所有详细信息。
Set Constraints properly so that TableView can calculate height properly, now set 正确设置约束,以便TableView可以正确计算高度,现在设置
tableView.estimatedRowHeight = 300 //Height you think you cell can have
tableView.rowHeight = UITableViewAutomaticDimension
if still need return UITableViewAutomaticDimension in tableView delegate HeightForRow. 如果仍然需要在tableView委托HeightForRow中返回UITableViewAutomaticDimension。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.