【发布时间】:2021-04-28 08:59:43
【问题描述】:
我正在尝试在 **SwiftUI** 中创建一个可点击的 **Image**,在浏览了几个网页后,我发现了以下代码:
Button(action: {
toggleWidth()
}) {
Image(systemName: "chevron.right")
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 20, height: 20)
.cornerRadius(40)
.buttonStyle(BorderlessButtonStyle())
}
创建以下输出: Buttons
无论我想做什么,我似乎都无法消除按钮本身的填充。 为了显示图像,我缺少什么按钮?
【问题讨论】: