One,. Reusing cells
In the data source method, repeat the drawing on the visible page
oc Method -(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) Indexpath; Swift method override func TableView (Tableview:uitableview, Cellforrowatindexpath Indexpath:nsindexpath)- > UITableViewCell
Therefore, you can do some processing in this method
Static NSString * "reusedcellid"; * Cell =private"reusedcellid"= Tableview.dequeuereusablecellwithidentifier (Reusedcellid, Forindexpath:indexpath)
This will prevent the cell from being created indefinitely, reusing the cell
Second, the cell image asynchronous loading
When the image is loaded asynchronously, the picture of the cell is executed in the child thread, but if it declines at this point, there will be a lag.
Workaround:
Download the image in the following two ways,
// when the drag is over -(void) scrollviewdidenddragging: (Uiscrollview *) ScrollView willdecelerate: (BOOL) decelerate// deceleration time -(void) scrollviewdidenddecelerating: (Uiscrollview *) ScrollView
Specific operation:
// Gets the visible part of the object Nsarray *visiblepaths = [Self.tableview indexpathsforvisiblerows]; for (Nsindexpath *indexpath in Visiblepaths) { // Gets the DataSource inside the object, And that you do not need to load the <code>-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) Indexpath
{ if (self.tableView.dragging = = NO && self.tableView.decelerating == NO) { // Span style= "color: #008000;" > start loading the picture asynchronously <code>}
Third, minimize the use of transparent layers
The internal rendering mechanism
Performance optimization for iOS development UITableView