如何将文本置于标签和图标下方居中?每次我在每个标签下方添加文本时,标签和图标都会移动。我错过了什么?
例如:
Text("sub title text")
.foregroundColor(Color(.systemGray))
.multilineTextAlignment(.center)
.padding()
我尝试插入的上面的代码将标签和图标移向错误的方向。我想将输入的文本置于每个标签和图标下方的中心。
struct ContentView: View {
var body: some View {
VStack {
Text("My Title")
.font(.system(.title))
.fontWeight(.bold)
.padding()
// MARK: LABELS
VStack (alignment: .leading) {
Label {
Text("Design")
.font(.title)
.foregroundColor(Color(.systemGray))
.labelStyle(.titleAndIcon)
.padding()
} icon: {
Image(systemName: true ? "pencil.circle" : "pencil.circle")
.foregroundColor(Color(.systemBlue))
.font(.title)
.multilineTextAlignment(.center)
}
// Text("sub title text")
// .foregroundColor(Color(.systemGray))
// .multilineTextAlignment(.center)
// .padding()
Label {
Text("Develop")
.font(.title)
.foregroundColor(Color(.systemGray))
.labelStyle(.titleAndIcon)
.padding()
} icon: {
Image(systemName: true ? "qrcode" : "qrcode")
.foregroundColor(Color(.systemBlue))
.font(.title)
}
Label {
Text("Launch")
.font(.title)
.foregroundColor(Color(.systemGray))
.labelStyle(.titleAndIcon)
.padding()
} icon: {
Image(systemName: true ? "cart.circle" : "cart")
.foregroundColor(Color(.systemBlue))
.font(.title)
//.imageScale(.large)
}
}//END Label VSTACK
}
.padding()
}//END VSTACK
}