I want to create a game menu which shows a list of different options like 'New Game'.
I've realised that with buttons:
var body: some View {
VStack {
Image("Title")
Group {
Button(LocalizedStringKey("new"), action: {}
Button(LocalizedStringKey("load"), action: {})
Button(LocalizedStringKey("save"), action: {})
Button(LocalizedStringKey("resume"), action: {})
Button(LocalizedStringKey("main"), action: {})
Button(LocalizedStringKey("tutorial"), action: {})
Button(LocalizedStringKey("credits"), action: {})
}
.background(Color.clear)
.font(.custom("Snell Roundhand", size: 24))
.padding()
}
}
How can I hide the background rectangle of the button? I want to see only the text. Touching the text should trigger the action.
Thanks to Asperi to point me into the right direction.
I just had to add
.buttonStyle(PlainButtonStyle())
to the group.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.