我正在尝试使SwiftUI中的按钮在文本旁边显示图像。但是,即使不在按钮中时图像也显示黑色。我需要对代码进行哪些编辑,以便正确显示图像。
这是我当前的代码:
List{
Button(action: {
self.changeAppIcon("AlternateIcon5")
}) {
HStack {
Image("AlternateIcon5")
.resizable()
.frame(width: 50,height: 50)
.cornerRadius(10.0)
Text("Navy Blue")
}
}
HStack {
Image("AlternateIcon5")
.resizable()
.frame(width: 50,height: 50)
.cornerRadius(10.0)
Text("Test")
}
}
它显示为: