gpt4 book ai didi

SwiftUI NavigationView 看不到图像

转载 作者:行者123 更新时间:2023-12-01 21:42:23 24 4
gpt4 key购买 nike

我有一个代码并制作了 NavigationLink 按钮,我写了文本和图像,但我的图像看不到。请帮助我。

VStack{
Image("Coachs")
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 370, height: 200)
//.clipped()
.cornerRadius(20.0)
NavigationLink(destination: Text("Detail view here")){
ZStack{
Text("Press on me")
.foregroundColor(.white)
.font(.largeTitle)
Image("Coachs")
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 370, height: 200)
//.clipped()
.cornerRadius(20.0)

}


}}

如果你看不懂我做屏幕 enter image description here

最佳答案

好的,我查看了其他图像类型,试试这个,它应该可以工作:

    Image("IMG_4944")
.renderingMode(.original) // <----- this
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 370, height: 200)
.clipped()
.cornerRadius(20.0)

关于SwiftUI NavigationView 看不到图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61168015/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com