【发布时间】:2019-11-13 18:55:41
【问题描述】:
我正在尝试将网格(使用滚动视图开发)放在滚动视图中,但我无法使用内容高度设置网格高度。我无法用.fixedsize()处理这个问题
GeometryReader{ reader in
ScrollView{
Text(reader.size.height.description)
Text(reader.size.height.description)
FlowStack(columns: 3, numItems: 27, alignment: .leading) { index, colWidth in
if index == 0{
Text(" \(index) ").frame(width: colWidth).border(Color.gray)
.background(Color.red)
}
else if index == 1{
Text(" \(index) ").frame(width: colWidth).border(Color.gray)
}
else if index == 2{
Text(" \(index) ").frame(width: colWidth).border(Color.gray)
}
else{
Text(" \(index) ").frame(width: colWidth).border(Color.gray)
}
}
.background(Color.red)
Text(reader.size.height.description)
Text(reader.size.height.description)
}.fixedSize(horizontal: false, vertical: false)
}
【问题讨论】:
-
只有这一段代码在你之后有点难以重复,你能至少给
FlowStackstruct吗?
标签: scrollview swiftui ios13 swift5 swiftui-list