我正在使用example from HWS,但我没有运气得到按钮显示在键盘上方。
Xcode 13.2.1 /运行iOS 15.3.1的物理设备
这是已知问题吗?
import SwiftUI
struct KeyboardView: View {
@State private var name = "Neil"
var body: some View {
TextField("Enter your name", text: $name)
.textFieldStyle(.roundedBorder)
.toolbar {
ToolbarItemGroup(placement: .keyboard) {
Button("Click me!") {
print("Clicked")
}
}
}
}
}
字符串
1条答案
按热度按时间laawzig21#
1.将父视图放入NavigationStack或NavigationView中
1.将文本视图放在NavigationView(而不是堆栈)中
字符串
测试版本:Xcode 15 beta 5