我建立了一个带有两个选项卡的弹出视图,每个选项卡都包含一个表单。我想给每个表单一个标题,所有在线文档都指向将每个表单包装在 aNavigationView
和 using 中.navigationBarTitle("Form Title")
。但是,当我为 iPad 构建它时,它最终会带有返回按钮以访问选项卡中的表单。比如这样:
和这个:
var body: some View {
NavigationView {
Form {
Section(header: Text("Question")) {
TextField("Question Title", text: $title)
TextField("Question Detail", text: $detail)
TextField("Word Count", text: $wordCount)
}
Section {
Button("Save") {
let newQuestion = ApplicationQuestion(context: self.moc)
newQuestion.title = self.title
newQuestion.detail = self.detail
newQuestion.wordCount = self.wordCount
try? self.moc.save()
self.presentationMode.wrappedValue.dismiss()
}
}
}
}
.navigationBarTitle("Full Screen")
}
实现这一点的正确方法是什么?