簡體   English   中英

CollectionView內部的iOS 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM