OGeek|极客世界-中国程序员成长平台

标题: ios - 具有自动高度的 TableViewCell 中的 TableView [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 18:19
标题: ios - 具有自动高度的 TableViewCell 中的 TableView

enter image description here

我有一个这样的细胞

里面的tableView是没有scroll enable的,但是有动态的cells,动态的contentSize

tableView 的高度取决于单元格

当我使用 UITableViewAutomaticDimension 为单元格自动调整大小时,

contentTableView.rowHeight = UITableViewAutomaticDimension

它不适用于内部 tableView

它只显示单元格的标签,而不是 tableView

有答案吗?谢谢



Best Answer-推荐答案


首先把这个写在viewDidLoad

self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 44.0;

StoryBord

中将 numberOfLine 属性设置为 0

将 UILable autolayout 设置为 Leading Trailing Top Bottom from super View

希望它会起作用......

详细说明请引用 Answer

关于ios - 具有自动高度的 TableViewCell 中的 TableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41159936/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4