UICollectionView performance - _updateVisibleCellsNow

后端 未结 10 1951
天涯浪人
天涯浪人 2020-12-07 07:36

I\'m working on a custom UICollectionViewLayout that displays cells organized by day/week/month.

It is not scrolling smooth, and it looks like the lag i

10条回答
  •  醉梦人生
    2020-12-07 08:15

    The issue isn't the number of cells you're displaying in the collection view total, it's the number of cells that are on screen at once. Since the cell size is very small (22x22), you have 154 cells visible on screen at once. Rendering each of these is what's slowing your interface down. You can prove this by increasing the cell size in your Storyboard and re-running the app.

    Unfortunately, there's not much you can do. I'd recommend mitigating the problem by avoiding clipping to bounds and trying not to implement drawRect:, since it's slow.

提交回复
热议问题