4

enter image description here

I want to load more data when view scroll to bottom,i.e. pull up to refresh, but I don't know how to display words like "Loading More..." as showing below and stop the tableview at that cell, because if use

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

there's an error:

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

and if there's no data for tableView, loading more is still at the bottom cell, e.g. a table can show 9 rows, if there's no data for tableview, the "Loading More" cell is at the 10th row.

remykits
  • 1,735
  • 4
  • 18
  • 20
  • i think this will help http://stackoverflow.com/questions/1480092/uitableview-scrolltorowatindexpath – Sagar In Oct 29 '13 at 11:50
  • This library does the same.It can be used to add pull up to refresh. https://www.cocoacontrols.com/controls/mnmbottompulltorefresh – arundevma Nov 25 '13 at 05:48

1 Answers1

5

I found a great example in AppCoda website, try to use it in your app.

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

I've used in my app and it really worked... and it is probably what you are looking for.

Eduardo Urso
  • 296
  • 3
  • 6