1

Im trying to build a scroll within 977 strings of data in the array placed in UITableView , well I'm using the following to do automatic calculation for the cell height : mytableView.rowHeight = UITableViewAutomaticDimension.

And using the following to scroll to index:

self.mytableView.scrollToRowAtIndexPath(NSIndexPath(forItem: placetogo, inSection: 0), atScrollPosition: UITableViewScrollPosition.Bottom, animated: false)

Whats happening here is the scroll is taking 16 seconds to scroll to that last index of the array which will be very annoying for the user, when i made the rowHeight = 400 or 300 static value , then it scroll with less than a second to last index.

My cells are different in there heights, so i cannot use the static cell height. I've made a research about it that tableview calls rowHeight frequently to calculate the height.which makes the scroll very slow, is there is any efficient way for that ?

I tried to split my data into 9 or 10 sections but still the same!

AaoIi
  • 8,288
  • 6
  • 45
  • 87
  • You can implement `estimatedHeightForRowAtIndexPath` to provide a hint tot the tableview and improve performance. – Paulw11 Oct 04 '15 at 12:38
  • Did you resolve this? – Tolgay Toklar Jul 14 '16 at 20:21
  • Nope, we have similiar issue http://stackoverflow.com/questions/38383408/scrolling-bottom-in-tableview-and-performance – Tolgay Toklar Jul 14 '16 at 20:24
  • @TolgayToklar so you are not very satisfied with that answers ? Maybe you can pre generate the cells and return the cells in cellForRowatIndexPath ! – AaoIi Jul 14 '16 at 20:27
  • No, they are same thing with my code. – Tolgay Toklar Jul 14 '16 at 20:28
  • I believe if i use setcontentoffset with keyboard, it will work properly. Do you know how to use? – Tolgay Toklar Jul 14 '16 at 20:30
  • @TolgayToklar why you need to set content offset if you are experiencing issue with scrolling ? It has nothing to do with it ? Or your issue is when the keyboard appears and you have to scroll down ? – AaoIi Jul 14 '16 at 20:34
  • Yep, i have to scroll down when keyboard appears. But I don't want to use scrollToRowAtIndexPath method for performance. – Tolgay Toklar Jul 14 '16 at 20:35
  • @TolgayToklar I don't think that what's app scrolls down this much , if you have noticed WhatsApp show the last 10 messages and when you scroll to top it gets the older messages from the server . You shouldn't scroll 5000 message at a time ! It took me long research to do , probably you should pre calculate the size of each single cell and pre generate the cells and don't use Automatic dimension for height when you have to return the cell. – AaoIi Jul 14 '16 at 20:37

0 Answers0