The question is as shown in the title.
Scenario: The current tableviewcell is spliced from three views and added to cell.contentView. When refreshing, I only need to refresh the content in one view of one of the cells.
But when the refresh cell method is executed, the three views are refreshed together, causing the view with unchanged data to flash.
How can you optimize this scenario?
If you use
self.tableView reloadRowsAtIndexPaths: withRowAnimation:
The refresh will flash, consider whether the layout has changed, checklayoutSubviews
, or re-create the view. This view is relatively expensive, optimize FPS and cache cell heightIt is called
reloadRowsAtIndexPaths
to achieve refresh. When layoutSubviews is called during refresh, the layout does not change. I set the view layout initially, and refresh the value of the control passed in the model.Asynchronous rendering has been optimized, and the height of each cell is fixed.
You have to control it through the data source. Don’t think about the view alone. Data is related to the reuse of cells