UICollectionView Scrolling is Very Choppy

安稳与你 提交于 2019-12-24 11:26:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!