search

Home  >  Q&A  >  body text

ios - How to refresh a View added on tableViewCell (not refresh the entire cell)

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?

曾经蜡笔没有小新曾经蜡笔没有小新2713 days ago1114

reply all(3)I'll reply

  • 怪我咯

    怪我咯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

    reply
    0
  • 某草草

    某草草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.

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新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

    reply
    0
  • Cancelreply