【问题标题】:how to implement loading more for table view when scroll to bottom?(i.e. pull up to refresh)滚动到底部时如何为表格视图加载更多内容?(即上拉刷新)
【发布时间】:2013-02-11 11:06:53
【问题描述】:

我想在视图滚动到底部时加载更多数据,即拉起来刷新,但我不知道如何显示如下所示的“正在加载更多...”之类的词并在该单元格处停止表格视图,因为如果使用

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行。

【问题讨论】:

标签: ios uitableview uiscrollview


【解决方案1】:

我在 AppCoda 网站上找到了一个很好的示例,尝试在您的应用中使用它。

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

我已经在我的应用程序中使用过,它确实有效......这可能就是您正在寻找的。​​p>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-07
    相关资源
    最近更新 更多