我創建了一個視圖,該視圖顯示一個按鈕,該按鈕具有一個帶有名稱和圖示的標簽。
struct NewWordButtonView: View {
@State var isAlert: Bool = false
var body: some View {
Button {
isAlert.toggle()
} label: {
Label("change word", systemImage: "arrow.triangle.2.circlepath").fixedSize()
}
.buttonStyle(.bordered)
}
}
它應該是這樣的:

但是,當我將工具列中的視圖添加為工具列項時,文本消失了,只剩下圖示了。像這樣:

有什么建議嗎?
uj5u.com熱心網友回復:
將titleAndIcon標簽樣式設定為您的label,這將確保同時顯示標簽的標題和圖示。
Label("change word", systemImage: "arrow.triangle.2.circlepath")
.labelStyle(.titleAndIcon)
.fixedSize()
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/512520.html
標籤:迅速按钮迅捷标签工具栏
