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
If you are implementing a grid layout you can work around this by using a single UICollectionViewCell
for each row
and add nested UIView
's to the cell
. I actually subclassed UICollectionViewCell
and UICollectionReusableView
and overrode the prepareForReuse
method to remove all of the subviews. In collectionView:cellForItemAtIndexPath:
I add in all of the subviews
that originally were cells setting their frame to the x
coordinate used in the original implementation, but adjusting it's y
coordinate to be inside the cell
. Using this method I was able to still use some of the niceties of the UICollectionView
such as targetContentOffsetForProposedContentOffset:withScrollingVelocity:
to align nicely on the top and left sides of a cell. I went from getting 4-6 FPS to a smooth 60 FPS.