【发布时间】:2021-04-24 00:47:17
【问题描述】:
我想创建一个按钮堆栈,就像使用 SwiftUI 有一个播放和录制按钮一样,创建后它看起来不像我想要的那样。
var body: some View {
HStack(alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/, spacing: 8) {
Spacer()
Button(action: {
print("Recordinggg")
}, label: {
Text("Record")
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(40.0)
})
Spacer()
Button(action: {
print("Recordinggg")
}, label: {
Text("Play")
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(40.0)
})
Spacer()
}
}
我真正想要的是这样的
【问题讨论】: