我创建了一个视图,显示一个按钮,其中有一个带有名称和图标的标签。
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)
}
}
Run Code Online (Sandbox Code Playgroud)
它应该看起来像这样:
但是,当我将视图添加到工具栏中作为工具栏项时,文本消失,仅保留图标。像这样:
有什么建议吗?