swiftui - 为什么部分框架不会调整大小以显示列表内容
问题描述
我有一个运行 ForEach 以返回标头的部分:然后另一个视图返回内容的 fetchRequest。问题是该部分的内容大小只有 fetchRequest 高的 1 行高。如果我应用大小的修饰符.frame(maxHeight: .infinity)
不会改变。如果我申请.frame(maxHeight: 200
它确实会变大。
为什么 .infinity 不动态增加高度
List{
ForEach(books, id: \.self) { thisbook in
Section(header:
HStack {
Text(thisbook.number ?? "number string error")
Text(thisbook.wrappedFirstname)
Text(thisbook.lastName ?? "Last Name string error")
Text(thisbook.to ?? "To string error")
Text(thisbook.from ?? "From string error")
})
{
BookList(filterKey: "number", filterValue: thisbook.wrappednumber){(books: Books) in
Text("\(books.wrappedBooks)")
}.frame(maxHeight: .infinity)
}
}
解决方案
推荐阅读
- reactjs - 点击时反应渲染两次
- angular - 如何克隆对象并在组件中表示它?
- tensorflow - 张量流 | GpuLauchKernel() 设备上没有可用的内核映像
- laravel - 回调时获取方法或网关链接(标签)的laravel 419过期错误
- c# - 如何通过“可执行文件路径”而不是“服务名称”删除 Windows 服务?
- python - 如何使用 vue 向 Flask 发布请求?
- discord - 从频道设置中删除用户 Discord.js v12
- amazon-web-services - kafka-connect 休息 api 超时
- python - 从 postgres 获取结果并在 python 中将其转换为 json
- sql - 使用代码列与扩展表查询 SQL