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?
怪我咯2017-06-15 09:25:52
If you use self.tableView reloadRowsAtIndexPaths: withRowAnimation:
The refresh will flash, consider whether the layout has changed, check layoutSubviews
, or re-create the view. This view is relatively expensive, optimize FPS and cache cell height
某草草2017-06-15 09:25:52
It 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.
曾经蜡笔没有小新2017-06-15 09:25:52
You have to control it through the data source. Don’t think about the view alone. Data is related to the reuse of cells