【发布时间】:2020-08-07 10:57:45
【问题描述】:
我正在尝试剪辑图像,当我们看到 UI 时,它看起来不错,但实际上它不会剪辑导致其他 UI 元素无响应的图像。
这是我正在使用的代码。
struct ImageContentView: View {
var urls:[String] = [
"https://lh3.googleusercontent.com/proxy/80im-IBfLODpLDj8d02uEpSVIhqdjen6H6CeFwgRBxeua-Dgw0R3WONFj1Gk8CwB_MufmC9rQ8qHjyWMejwFcJ1PA2s8AAu5WVsmJA=s0-d",
"https://wallpaperaccess.com/full/530919.jpg"
]
var body: some View {
ScrollView{
VStack{
Button(action: {
}, label: {
Text("Hello")
})
VStack(spacing: 20.0) {
ForEach(self.urls, id:\.self) { url in
WebImage(url: URL.init(string: url)!)
.resizable()
.aspectRatio(contentMode: ContentMode.fill)
.frame(height: UIScreen.main.bounds.size.width * 0.5)
.clipped()
.cornerRadius(10.0)
.shadow(color: Color.red, radius: 10.0, x: 0, y: 0)
}
}.padding()
}
}
}
}
【问题讨论】:
-
我尝试了 ContentShape 和 ClipShape,但没有成功。
-
这个有什么更新吗?你找到解决办法了吗?
标签: swiftui imageview xcode11 sdwebimage clipped