问题
Why method estimatedHeightForRowAt of the UITableViewDelegate protocol is not called when we are scrolling UITableView?
Method estimatedHeightForRowAt is called only when we initialize UITableView.
回答1:
Method estimatedHeightForRowAt is called only when we initialize UITableView.
Correct. It is called for all rows up front, so we can estimate the whole height of the table content. That is exactly what it is for.
When you scroll and the new rows are about to appear, those are now real rows with real cells in them, so now you must give the real heights!
来源:https://stackoverflow.com/questions/40341652/estimatedheightforrowat-is-not-called-on-scroll