0

I am building a chat application. I use UTableView to construct chat box. When I load chat box screen, I need to scroll tableview to the index path of last unread message. I am using scrollToRowAtIndexPath method to do so. In this case, cellForRowIndexPath is called for all the cell's from indexPath 0. This badly affects application performance. Since I am using automatic dimension for cell height, I won't be able to use setContentOffset method also.

Is there any other way to scroll tableview to required indexPath without loading intermediate cells?

Umair Afzal
  • 4,947
  • 5
  • 25
  • 50
Advaith
  • 1,087
  • 3
  • 12
  • 31

1 Answers1

0

I can think of 2 ways you can achieve desired behavior.

  1. Using scrollToRowAtIndexPath with animated = false
  2. Using setContentOffset method with calculated height. This will require actually calculate cell's height.
tereks
  • 1,256
  • 9
  • 15