Oleg Gordiichuk Oleg Gordiichuk - 1 month ago 15
iOS Question

estimatedHeightForRowAt is not called on scroll

Why method

estimatedHeightForRowAt
of the
UITableViewDelegate
protocol is not called when we are scrolling
UITableView
?

Method
estimatedHeightForRowAt
is called only when we initialize UITableView.

Answer

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!

Comments