It should be that the height calculation is lagging. The display order of tableView is roughly: Request sectionNumber and numberForSection to get the total number of sections and cells. sectionNumber 和 numberForSection 获取一共有多少个section和cell。 请求 heightForRow:atIndexPath 获取即将显示在界面上的 cell 的高度。 然后请求 cellForRow 获取这个 cell 的实例。 然后设置 cell 的高度等,layout 之后调用 willDisplayRequest heightForRow:atIndexPath to get the height of the cell that will be displayed on the interface.
Then request cellForRow to get an instance of this cell.
Then set the height of the cell, etc., and then call callback methods such as willDisplay after layout, and then display it on the interface.
So when you refresh the tableView, the processing of the height part should be to first calculate the cell height according to the data source instead of letting the cell instance calculate it and then call back to the controller. Of course, you can also calculate in the cell. For example, there is a class method in the cell, which is calculated based on the incoming cell data, and the controller actively calls this method. The approximate code is as follows:
In the delegate implementation class of controller or tableView:
It should be that the height calculation is lagging.
Then requestThe display order of tableView is roughly:
Request
sectionNumber
andnumberForSection
to get the total number of sections and cells.sectionNumber
和numberForSection
获取一共有多少个section和cell。请求
heightForRow:atIndexPath
获取即将显示在界面上的 cell 的高度。然后请求
cellForRow
获取这个 cell 的实例。然后设置 cell 的高度等,layout 之后调用
willDisplay
RequestheightForRow:atIndexPath
to get the height of the cell that will be displayed on the interface.cellForRow
to get an instance of this cell.Then set the height of the cell, etc., and then call callback methods such as
willDisplay
after layout, and then display it on the interface.So when you refresh the tableView, the processing of the height part should be to first calculate the cell height according to the data source instead of letting the cell instance calculate it and then call back to the controller. Of course, you can also calculate in the cell. For example, there is a class method in the cell, which is calculated based on the incoming cell data, and the controller actively calls this method. The approximate code is as follows:
In the delegate implementation class of controller or tableView:
🎜MyTableViewCell:🎜