如何像在安卓中一样动态设置表格视图高度。 我尝试使用以下代码,但它不起作用。
tblHeightConstraint.constant = downSelectionTbl.contentSize.height
看到下面的链接,即使它没有解决我的问题,我也厌倦了赞成的答案。
iOS:在 Swift 中动态设置 UITableView 高度
像这样做,
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
tblHeightConstraint.constant = downSelectionTbl.contentSize.height
}