【发布时间】:2020-06-14 06:13:53
【问题描述】:
我想在按下按钮时更改图像名称。
这是我目前的结构:
struct ContentView: View {
@State var matrix = [Int] var
body: some View {
VStack {
Text("Test")
HStack(alignment: .center, spacing: 8) {
Button(action: {
**
// call a func that will do some check and
// change the image from Blue.png to Red.png
**
}) {
Image("Blue")
.renderingMode(.original)
.resizable()
.aspectRatio(contentMode: .fill)
.clipShape(Circle())
}
}
}
}
}
【问题讨论】: