0

我有一个没有刷新控件的 collectionView,但我确实允许它反弹。

lazy var collectionView: UICollectionView  = {

    // insatiate the cv, its frame is the entire device w/h
    collectionView.alwaysBounceVertical = true
    collectionView.refreshControl = nil
    collectionView.isPagingEnabled = true

    return collectionView
}()

在第一个单元格上,在cellForItemAt indexPath运行并且单元格具有其内容之后,如果我将 cv 拉下,就像刷新一样,它会反弹回来。一旦它反弹回来并击中屏幕顶部(它的原始位置),就会cellForItemAt indexPath重新运行。我在单元格中有一些内容正在重置,因为cellForItemAt indexPath再次运行。

这只发生在第一个单元格中,我该如何防止这种情况?

4

0 回答 0