[英]How to increase the icon button of Menu in MacOS App SwiftUI?
I want to increase the icon button of the Menu
in SwiftUI for a macOS app, but modifiers such as .imageScale(.large)
, .resizable()
, .scaleEffect(1.2)
, and changing font
doesn't work.我想为 macOS 应用程序增加 SwiftUI 中
Menu
的图标按钮,但.imageScale(.large)
、 .resizable()
、 .scaleEffect(1.2)
等修饰符和更改font
不起作用。 image图片
Menu {
Button("Quit") {}
} label: {
Image(systemName: "gear")
.font(.title)
.resizable()
.scaleEffect(1.2)
.imageScale(.large)
}
.menuStyle(.borderlessButton)
.menuIndicator(.hidden)
How can I change icon size?如何更改图标大小?
Use Image
in Text
.在
Text
中使用Image
。
struct DetailView: View {
var body: some View {
Text("hello")
.contextMenu {
Button(action: { }) {
Text(Image(systemName: "gear"))
.font(.largeTitle)
}
Button(action: { }) {
Image(systemName: "gear")
}
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.