我有一个带有自定义图像的标签。我想让图像调整大小,但我找不到任何方法来做到这一点。这是我的代码;
Label("Continue with Google", image: "googleLogo")
.foregroundColor(.white)
.background(Color.red)
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏!
小智 12
你可以这样写:
Label {
Text("Continue with Google")
} icon: {
Image("googleLogo")
.resizable()
.scaledToFit()
}
Run Code Online (Sandbox Code Playgroud)
希望它可以帮助你。