Recently read an article on how to improve the performance of UITableView, English original address: https://medium.com/ios-os-x-development/ Perfect-smooth-scrolling-in-uitableviews-fd609d5275a5#.jet1gcbax, after reading the important content summarized as follows:
1, for:
Tableview:cellforrowatindexpath:
Don ' t perform data binding at the this point, because there's no cell on the screen yet. For this can use TableView:willDisplayCell:forRowAtIndexPath:method which can is implemented in the delegate of UITABL Eview. The method called exactly before showing cell in UITableView ' s bounds;
Do not assign a value to the cell in this method because the cell is not present at this time. You can do this in TableView:willDisplayCell:forRowAtIndexPath: This is also a proxy method for UITableView, This method is called when the cell is about to be displayed in the range of UITableView.
2. When returning to the height of the cell
I recommend not using even complex math calculations on your IT to define further height of a cell, only addition, Subtra ction, multiplication and division (if possible).
When deciding the height of the cell to be displayed, it is recommended not to use complex calculations, if possible only with subtraction;
3. How is the height of the cell automatically adapted with AutoLayout?
If the sub-view is small, it can be, if the sub-view, using AutoLayout, performance will be reduced a lot: And more subviews you have, less quickly autolayout works.
4. Perform code optimizations to achieve balance of loading CPU & GPU. You should clearly know which part of rendering must is done by the GPU, and which one?—? by the CPU for keeping balance.
Optimize your code to achieve the balance of CPU and GPU usage, and you should know in advance where to use the GPU to render, and where to use the CPU to keep the balance between them;
5. We can perform rendering at the CPU by using the Coregraphics operations in Drawrect:method of the UIView by the this to:
We can choose Coregraphics to render using the CPU in the DrawRect method, as shown in the example code below
How can I improve the performance of UITableView in iOS?