你好有很多问题回答的动态高度的UITableViewCell的UITableView.但是当我这样做时,我发现它很奇怪.
这是一些答案:
通常这会回答细胞的动态高度
tableView.estimatedRowHeight = 44.0
tableView.rowHeight = UITableViewAutomaticDimension
Run Code Online (Sandbox Code Playgroud)
但在我的情况下,我想知道这条线不会做任何事情.
UITableView单击splitview中的tabbar后,我正在查看我的内容.这有用吗?
也许我错过了什么.谁能帮助我,我花了2个小时做傻事.
这些是我对标题的约束,标题可能很长,但标签不是.

这是我的手机

我有两个TableViews,当我设计原件时,我使用情节提要中的原型单元来设计它,为了使其可重复使用,我尝试将其拉出.xib并加载它。cellID.xib然而,当它被加载时,它在运行时失去了所有的约束,一切都在彼此之上。
let cellIdentifier = "cellID"
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(UINib(nibName: cellIdentifier, bundle: nil), forCellReuseIdentifier: cellIdentifier)
tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 300
}
Run Code Online (Sandbox Code Playgroud)