Reputation: 8035
I load more data from server when i am 5 rows from the end of my tableview.
I use (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
for this.
It works most of the time, but sometimes when i scroll really fast, a row gets skipped and so my function for loading more data is not called.
How should i fix it, so willDisplayCel delegate function will be called for every row that gets scrolled by?
Upvotes: 1
Views: 1115
Reputation: 11053
Are the cells still visible for which the method is not called or have you skipped them by scrolling real fast?
This method will only be called for cells that are visible - so if you scroll fast the system thinks that they are not being displayed anyway.
I would suggest to change the logic on when to load more data - since no connection will be fast enough for this to get you the data from the server.
You may either use the bouncing technique or have the very last line of your table view to initiate loading more lines. This way you can be sure that the app and the user will wait a little for the data to be retrieved from the server.
Upvotes: 1