键盘出现时如何显示完整的列表?键盘隐藏在列表的下部。
我的列表行中有一个textField。当键盘出现时,无法向下滚动以查看完整列表。键盘在列表的前面,而不在列表的“下面”。这是我的编码:
struct ContentView: View {
@State private var name = ""
var body: some View {
List {
VStack {
Text("Begin")
.frame(width: UIScreen.main.bounds.width)
.padding(.bottom, 400)
.background(Color.red)
TextField($name, placeholder: Text("enter text"), onEditingChanged: { _ in
//
}) {
//
}
Text("End")
.frame(width: UIScreen.main.bounds.width)
.padding(.top, 400)
.background(Color.green)
}
.listRowInsets(EdgeInsets())
}
}
}
Run Code Online (Sandbox Code Playgroud)
有人可以帮我怎么做吗?
非常感谢你。