I suppose the result should be like this
我的代码:
struct AddNewCardSetView: View {
var body: some View {
NavigationView{
Button(action: addNewPhotoToCardSetCover) {
Text("Select Photo")
.navigationBarTitle(Text("New CardSet")
, displayMode: .inline
)
.navigationBarItems(trailing:
Button(action: addNewPhotoToCardSetCover, label: {
Text("Done")
}))
}
}
}
}
如您所见,问题在于NavigationView非常大,我使用NavigationLink将此页面链接为目标。
第一次编码微调,不知道如何解决。
关于主页使用NavigationLink:
List {
ForEach(card.cardsets) { cardsets in
CardSetRow(cardsets: cardsets)
}
.onMove(perform: moveCardSets)
.onDelete(perform: deleteCardSets)
}
.resignKeyboardOnDragGesture()
.navigationBarTitle("CardSets")
.navigationBarItems(leading:
HStack {
NavigationLink(destination: AddNewCardSetView()) {
Image(systemName: "plus")
}
Button(action: bookmarkCardSet, label: {
Image(systemName: "bookmark")
})
},
trailing:
EditButton()
)