如何实现表视图加载更多的时候滚动到底?(即拉起刷新)(how to implement loadin

2019-08-17 04:13发布

我要加载更多数据时,视图滚动至底部,即拉起刷新,但我不知道该怎么如下说明显示,如“加载更多...”字样,并在该小区停止的tableview,因为如果使用

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:10 inSection:0];
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];

有一个错误:

*** Terminating app due to uncaught exception 'NSRangeException', reason: '-[TNTableView _contentOffsetForScrollingToRowAtIndexPath:atScrollPosition:]: row (10) beyond bounds (0) for section (0).'

如果有针对的tableView的数据,装载更多的是仍处于底部的细胞,例如表格可以显示9行,是否有对应的tableview没有数据,“加载更多”细胞是在第10行。

Answer 1:

我发现在AppCoda网站一个很好的例子,尝试在你的应用程序中使用它。

http://www.appcoda.com/pull-to-refresh-uitableview-empty/

我在我的应用程序使用,效果真的不错...它可能是你在找什么。



文章来源: how to implement loading more for table view when scroll to bottom?(i.e. pull up to refresh)