当我距离表格视图末尾 5 行时,我从服务器加载更多数据。我用(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
这个。
它大部分时间都有效,但有时当我滚动得非常快时,会跳过一行,因此不会调用我加载更多数据的函数。
我应该如何修复它,所以将为滚动的每一行调用 willDisplayCel 委托函数?
当我距离表格视图末尾 5 行时,我从服务器加载更多数据。我用(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
这个。
它大部分时间都有效,但有时当我滚动得非常快时,会跳过一行,因此不会调用我加载更多数据的函数。
我应该如何修复它,所以将为滚动的每一行调用 willDisplayCel 委托函数?
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.