ios - 基于其中的 UICollectionView 单元格的 tableview 单元格的动态高度
问题描述
我有tableview单元格,里面有collectionview,还有collectionview单元格,如何根据collectionview单元格设置tableview单元格的高度?
解决方案
尝试将其添加到您的控制器中
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
推荐阅读
- ruby-on-rails - 如何检查表的单行中有多少列是“nil”
- node.js - 使用 Passport 和 Socket.io 进行 JWT 身份验证
- angular - ng 测试:[object ErrorEvent] 抛出
- ibm-mq - 没有 libmqic.so 的 ITRS、NetProbe、MQ QUEUE PLUG-IN
- python - Python 圆角变量打印 0
- xml - 如何在 Beanio Xml 中将数字格式转换为字符串
- mysql - 来自通用函数“dbListFields”的无效值,“数字”类,预期的“字符”
- python - 使用永无止境的线程处理带有 Newspaper3k (python3 lib) 的 URL 列表
- php - mysql 连接查询没有得到正确的输出
- mysql - 如何解决 java.sql.BatchUpdateException: number not valid