![](/img/trans.png)
[英]Populating dynamic data in CollectionView which is inside TableView
[英]iOS TableView inside of a CollectionView sometimes shows incorrect data
我有一個collectionView,在其中我在tableView中顯示注釋列表。 當滾動collectionView時,我看到tableView數據不是正確的數據。
我試圖通過使用prepareForReuse()進行補救,但這是行不通的。 這是我的代碼:
override func prepareForReuse() {
super.prepareForReuse()
imageView.image = UIImage()
commentsTableView = UITableView()
}
如果有人可以提出解決方案,我將不勝感激。
謝謝。
將所有屬性分配為nil。
override func prepareForReuse() {
imageView.image = nil
commentsTableView = nil
super.prepareForReuse()
}
但是請確保您的屬性是可選的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.