问题
The scrolling on my UICollectionView is really choppy. As I scroll past half the screen, it gets stuck for a moment and then proceeds. How can I make the scrolling more smooth using SWIFT?
回答1:
Use Time Profiler instrument to find out where the bottleneck is. Swift has nothing to do with scroll view's performance.
回答2:
There are two complementary ways:
1) [Fast way] When choppy effect is large enough for giving you time for pressing pause button on the debugger. And then review what is doing main thread (Thread 1), most probably won't be doing UI tasks. Move those task to background.
2) When doesn't use instruments with core image.
回答3:
This one help for you put this code after dequeueReusable Cell
cell.layer.shouldRasterize = YES;
cell.layer.rasterizationScale = [UIScreen mainScreen].scale;
来源:https://stackoverflow.com/questions/32420956/uicollectionview-scrolling-is-very-choppy