UICollectionView performance - _updateVisibleCellsNow

后端 未结 10 1967
天涯浪人
天涯浪人 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:33

    Also don't forget to try to rasterize the layer of the cell:

    cell.layer.shouldRasterize = YES;
    cell.layer.rasterizationScale = [UIScreen mainScreen].scale;
    

    I had 10 fps without that, and boom 55fps with! I'm not really familiar with GPU and compositing model, so what does it do exactly is not entirely clear to me, but basically it flatten the rendering of all subviews in only one bitmap (instead of one bitmap per subview?). Anyway I don't know if it has some cons, but it is dramatically faster!

提交回复
热议问题