简体   繁体   English

SwiftUI TabView 中的 AsyncImage 未显示

[英]SwiftUI AsyncImage in TabView is not showing

Images are shown without TabView but not with TabView.图像在没有 TabView 的情况下显示,但没有 TabView。

Also, I got the log below in Debug Console另外,我在调试控制台中得到了下面的日志

[UICollectionViewRecursion] cv == 0x107829812 Disabling recursion trigger logging [UICollectionViewRecursion] cv == 0x107829812 禁用递归触发器日志记录

How can I fix it?我该如何解决?

TabView {
    AsyncImage(url: URL(string: "link"))
    AsyncImage(url: URL(string: "link"))
}.tabViewStyle(.page)
.frame(height: 300)
.frame(maxWidth: .infinity)

Putting the AsyncImage into a ZStack makes it work as stated here .AsyncImage放入ZStack使其按此处所述工作。 The reason for this is not obvious to me and I would assume it is an issue with AsyncImage .这样做的原因对我来说并不明显,我认为这是AsyncImage的问题。 In any case it works with VStack and HStack as well.在任何情况下,它也适用于VStackHStack Using a simple View with AsyncImage as content or putting it in a Group didn't work for me.使用带有AsyncImage的简单View作为内容或将其放入Group中对我不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM