UICollectionView performance - _updateVisibleCellsNow

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

    Thought I would quickly give my solution, as I faced a very similar issue - image-based UICollectionView.

    In the project I was working in, I was fetching images via network, caching it locally on device, and then re-loading the cached image during scrolling.

    My flaw was that I wasn't loading cached images in a background thread.

    Once I did put my [UIImage imageWithContentsOfFile:imageLocation]; into a background thread (and then applied it to my imageView via my main thread), my FPS and scrolling was a whole lot better.

    If you haven't tried it yet, definitely give a go.

提交回复
热议问题