这里无论如何都要使用原生单元并将大小调整为detailTextLabel大小?
小区配置:
let cell = UITableViewCell(style: .value1, reuseIdentifier: UITableViewCell.reuseID)
cell.accessoryType = .disclosureIndicator
cell.selectionStyle = .none
cell.textLabel?.numberOfLines = 0
cell.detailTextLabel?.numberOfLines = 0在我的例子中,textLabel只有1行,但detailTextLabel有3行。

我注意到通过在textLabel.text上添加一些"\n“,单元格最终可以正确地调整大小,有没有更干净的解决方案?
发布于 2021-06-18 15:03:53
UITableViewAutomaticDimension = self.tableView.estimatedRowHeight = 50 self.tableView.rowHeight
https://stackoverflow.com/questions/68026571
复制相似问题