I am having a requirement in an app where almost each uitableviewcell is having different height. Also, many cells have Images (1,2 or 3) with text.
Earlier I was using the heightForRowAtIndexpath but as usual, the performance was very pathetic with jerky feel,
I did following to resolve the issue,
- Implemented estimatedHeightForRowAtIndexPath
- Used cache for the calculated height for subsequent calls to estimatedHeightForRowAtIndexPath
- Using autolayout in all the cells.
With this the Performance is much better, as compared to previous approach, but, the estimatedHeightForRowAtIndexPath is called so many times subsequently due to which the list is jerky.
If the cell number N is loaded, the estimatedHeightForRowAtIndexPath is called N-1 times, and this happens if we go further in list, if we go backward it knows the estimated height.
Please help me understand why this happens and what can I do to increase the performance and make the scroll Jerk-less and smooth.