I am using the estimatedRowHeight
method from UITableView in iOS 7, which works perfectly for fast loading of a UITableView with 5000 rows of variable heights.
My UITableView consists of 50 sections. Every section has 100 rows, of variable height.
At the start I use estimatedRowHeight
for fast-loading, but after that when I call scrollToRowAtIndexPath
, my UITableView scrolls to the wrong offset. I can understand why this is, because it has an estimatedRowHeight
until I scroll the entire table and the proper cell heights are set in the heightForRowAtIndexPath
delegate method.
Any solution?
Unfortunately this issue is to be expected when using estimatedRowHeight
in your code with such a low value. When you scrollToRowAtIndexPath
it does not actively calculating the correct size as you go. The underlying cause is, if you scrolled from Section 1 to Section 2, it could feasibly calculate the correct position on the fly and the estimatedRowHeight
of the cells if it was a relatively new device. Any older devices would be brought to their knees, and even any new ones would be as well if you had to process 5000 cells, for example.
A maybe-solution to your problem could be to increase the estimatedRowHeight
constant so the device doesn't have to do as much work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With