UITableView in the actual development of the use of frequency is very high, therefore, UITableView performance optimization is essential, this article slightly summarizes the UITableView performance optimization that point.
This article focuses on specific methods, the principle of the words in the end of the article will give some links, interested can be viewed by themselves.
1. About Data binding
A lot of new iOS friends like to write data binding to the UITableView the source method
-(UITableViewCell *) Cellforrowatindexpath: (Nsindexpath *) Indexpath
Inside. This is not very accurate, because the cell is not actually generated, try to write data binding in the
-(void) TableView: (UITableView *) TableView Willdisplaycell: (UITableViewCell *) cell Forrowatindexpath: (Nsindexpath *) Indexpath;
This method, because the cell has been created and is ready to be displayed on the interface.
2. About cell reuse.
Cell reuse is the official recommendation of Apple, so it is very helpful to ensure that the cells that you create are reused to improve performance.
3. About Height calculations
The method of height calculation, if called multiple times, is positive for performance loss. Of course, if your altitude is dead, you will not have this problem. If not, then you may need to design a method that calculates the height of each cell that needs to be shown first, and then calls it directly when the cell height is set.
Provide a way to calculate the height of the cell content (intercept online):
The height setting can then be implemented as follows:
4. About AutoLayout
Although Apple's official recommendation is to use AutoLayout for program development, AutoLayout can lead to some loss of performance and, of course, it is convenient to develop with AutoLayout if your program is not very high performance requirements.
5. About CPU and GPU scheduling use
The properties of various layers, such as transparency, fillet, etc., can cause performance loss.
So, you can try not to directly set the fillet of the picture, first get the picture asynchronously, call Coregraphics to handle the picture and then return.
So your picture processing will be handed over to the backstage without affecting the fluency of your program.
6. Other optimization methods
To try this https://github.com/facebook/AsyncDisplayKit framework, the framework integrates a large number of asynchronous operations, turning UIView-a calayer into Calayer-Node, a lightweight -level controls plus asynchronous operations will give your program a better performance.
Attach some links:
1. http://blog.ibireme.com/2015/11/12/smooth_user_interfaces_for_ios/
2. http://southpeak.github.io/blog/2015/12/20/perfect-smooth-scrolling-in-uitableviews/
Then recommend a few favorite technical blogs:
1. http://blog.ibireme.com
2. http://www.superqq.com
3. Http://southpeak.github.io
Finally, Apple Pay seems to be on fire recently. To turn an article between articles:
Http://www.cnblogs.com/easyToCode/p/5196328.html
Ios_uitableview performance optimization that's something.