Cell of UICollectionView not always refreshed after a scroll

前端 未结 2 1596
囚心锁ツ
囚心锁ツ 2021-02-13 12:06

I have defined in my Storyboard (iPad) a view that contains a UICollectionView, at the bottom of the view there\'s also a UIToolbar. In the UICol

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-13 12:36

    This seems to be a bug in UICollectionView when using sectionInsets. The cells don't get invisible, they are misplaced out of bounds sometimes on fast scrolling.

    So if you normally would have 3 items per row, you will get a forth item in one row, but no item at the first spot of the next row.

    If you set your UICollectionView to not clip to bounds, and move it on top of your UI, you might see this misaligned cell.

    My solution was so far to not use sectionInsets, and surround it by using contentInset and some empty space in the section headers.

    I also found some other guys at Twitter with the same problem. There's also a bug report about it: 12353513

提交回复
热议问题