我是SwiftUI的新手,我将为无法定位的自定义按钮的位置提供一些帮助。 我已经使用VStack和HStack尝试使按钮底部居中,但是按钮保持左对齐。 任何帮助将不胜感激。
struct ContentView: View {
var body: some View {
VStack {
NavigationView {
Section {
VStack(alignment: .leading) {
Text("Meal Description").foregroundColor(.green)
Spacer()
NavigationLink(destination: poundedYam()) {
Text("pounded Yam & Egusi Soup")
}
NavigationLink(destination: YamPepSoup()) {
Text("Yam and Pepper Soup")
}
NavigationLink(destination: JollofRice()) {
Text("Jollof Rice & Plantain")
}
Spacer()
.frame(minWidth: 0,maxWidth: .infinity,minHeight: 0,maxHeight: .infinity,alignment: .topLeading)
}.padding()
}
Section {
Image("africanfoods")
.resizable()
.frame(width: 275.0,height: 250.0)
.clipShape(Circle())
.overlay(Circle().stroke(Color.black,lineWidth: 5))
.scaledToFit()
}
VStack { //For Button
Spacer()
Button( action: {},label: { Text("Create Order") })
}
.navigationBarTitle(Text("Menu"))
} //NavView End
} //VStack End
}
}