6

I'm working on developing a newsfeed where most cells have different heights from each other. So I'm using Apple's new built-in system to calculate the height of the rows dynamically in iOS8.

The problem happens when I have to load a new page. When I do that, then scroll back towards the top, the content size of the table appears to be smaller than it should and the loading of the cells is really choppy. So when I start scrolling upwards, I'll be at the 5th cell and then all of the sudden the 4th cell will jump down. I attached the project if you guys want to see my code: https://github.com/KhanFu/TableView-Dynamic-Cell-Height-Pagination

If you keep an eye when you're scrolling the table view, you'll see it jumps upwards. To re-create the bug, first scroll all the way to the bottom, so it loads the next page (11, 12, and 13). Then start scrolling upwards. For the clearest version of this, keep your eye on the number 7. Watch how it almost instantaneously becomes 6.

Essentially, when the content offset of the table reaches the bottom of the table, I adds an object to the table's data, then I add a row with insertRowsAtIndexPaths.

I've been banging my head against this problem for awhile now. Let me know if you need more information. Thanks!

KhanFu
  • 81
  • 5

0 Answers0