这..。
struct Settings: View {
@AppStorage("Units") var units: String = "Miles"
var body: some View {
NavigationView {
Form {
SwiftUI.Section {
HStack {
Picker("Units", selection: $units) {
Text("Miles")
Text("Kilometres")
}
.pickerStyle(MenuPickerStyle())
Spacer()
Text(units)
}
}
}
}
.navigationBarTitle("Settings")
}
}
=
有两个很大的差距。
一个在标题下面,另一个在导航栏下面。
如何消除这些差距?
发布于 2020-10-05 13:11:04
假设您在Settings
的父级中已经有了NavigationView
,所以只需删除多余的一个
struct Settings: View {
@AppStorage("Units") var units: String = "Miles"
var body: some View {
// NavigationView { // << this one should be removed !!
Form {
https://stackoverflow.com/questions/64209200
复制相似问题