十个额外的 UITableViewCellContentView 在 TableView 中显示为空白并堆叠在一起。有时会发生,有时不会

Ten extra UITableViewCellContentViews appear blank and stacked on top of each other in the TableView. Sometimes it happens, sometimes it doesn't

提问人:yselimguner 提问时间:7/19/2023 最后编辑:oneshotyselimguner 更新时间:7/26/2023 访问量:37

问:

十个额外的 UITableViewCellContentView 在 TableView 中显示为空白并堆叠在一起。有时它发生,有时它不会。您提到您已经定义了上方和下方的单元格,但仍然出现 10 个空单元格。我不确定为什么会这样。有没有人可以帮忙?

enter image description here

uitableview uicollectionviewcell rx-swift

评论

0赞 Daniel T. 7/20/2023
为表视图提供数据的可观察对象的输出是什么?您使用的是哪种类型的 DataSource?
0赞 yselimguner 7/23/2023
我正在向服务器发出 2 个 API 请求。首先 let section = SectionModel<DKSection,DKSectionItem>(model: DKSectionAdapter(identifier: “”, title: “”, height: 0), items: [result]) var sections = self?.数据值??[] sections.insert(section, at: 0) self?.data.accept(部分)
0赞 yselimguner 7/23/2023
let section 的第二个 = SectionModel<DKSection,DKSectionItem>(model: DKSectionAdapter(identifier: “”, title: “”, height: 0), items: response.data) var sections = self?.数据值??[] if sections.count > 1 { sections.popLast() } sections.append(section) self?.data.accept(部分)
0赞 yselimguner 7/23/2023
我已经在 TableViewCell 上实现了结构。在第一个单元格中,有一个 UICollectionView。我将第一次 API 调用获取的数据设置为此 UICollectionView。对于其他单元格,我按顺序显示从第二个 API 调用返回的数据。
0赞 Daniel T. 7/24/2023
编辑您的问题并在其中添加代码。此外,在调用之前放置一个,并显示调试在问题中输出的内容。我将能够通过这些信息提供更多帮助。.debug().bind(items:)

答:

0赞 Daniel T. 7/24/2023 #1

根据您在评论中发布的代码,我遇到的第一个问题是两个部分具有相同的标识符 .那不行。每个部分都必须有一个唯一的标识符。""

更多的帮助将需要更多的代码。