我的选择视图超出了仅在设备上的帧大小,而在模拟器中工作得很好。此视图不是表单或列表的一部分,仅在VStack中。
var body: some View {
HStack {
Text(title)
.foregroundColor(.gray)
Spacer()
if isEditing {
Picker(selection: $value) {
Section {
Text("None").tag("None")
}
Section {
ForEach(Countries.all, id: \.self) { i in
Text(i).tag(i)
}
}
} label: {}
.frame(height: DocumentPage.rowHeight) // <-- This is ignored
} else {
// View when not editing
}
}
.frame(height: DocumentPage.rowHeight) // <-- And this is ignored
}仿真器对设备的研究


发布于 2022-11-21 20:57:56
在Picker()上使用.layoutPriority(1),在Text()上使用.fixedSize()帮助。
https://stackoverflow.com/questions/74514832
复制相似问题