I create a chat using UITableView. Naturally, the row heights of each chat message cell will vary greatly. I correctly calculated the row height for each cell, and the Table View does as it should.
However, I want to implement estimatedHeightForRowAtIndexPath:in order to speed things up in case of multiple messages. The problem is that this affects the scroll behavior scrollToRowAtIndexPath:atScrollPosition:Animated:.
In my lifecycle method, viewWillAppearI tell Table View to scroll down to the last message (i.e. the bottom message), which works well if I don’t use it estimatedHeightForRowAtIndexPath:, but as soon as I do this it seems that only the value returned by this method is used to calculate scroll position, and I get into the wrong position.
Is it possible to capitalize on improved utilization estimatedHeightForRowAtIndexPath:without affecting scroll behavior?
source
share