0

I have made an uitableView and I am fetching data from json from a webservice

now i want that I get first 20 object first and load it in my tableView. it is happening properly

Now I want that when user scroll to the footer ..next 20 data should be fetched and it should be shown in tableView..

I am stuck here ..can anyone give me any idea how to proceed next?

Hitesh
  • 1,230
  • 1
  • 10
  • 12

3 Answers3

1

You can use a ready made implementation of a UITableView with pull-to-refresh functionality.

Have a look at EGOTableViewPullRefresh or for a simpler implementation to PullToRefresh.

If you are interested in implementing this yourself, one approach is to add a subview to your UITableView (e.g., UILabel showing the "pull to refresh" message); then "intercept" the delegate methods when the user scrolls down (or up) and calculate whether the subview came into the viewable frame. Then issue the reload.

Another approach would be adding a last row to your table; then when the tableView:cellForRowAtIndexPath: method of your data source is called, return a cell with the "pull to refresh" message and do the refresh.

But you will be better off using one of the suggested implementations.

sergio
  • 68,819
  • 11
  • 102
  • 123
1

May be you can put Load more button in footerview and by tapping that you can load another 20 records from server ?

Another method is to implement Pull To Refresh and modify it as per your need.

Deeps
  • 4,399
  • 1
  • 26
  • 27
0

To know if you reached the button of the table (aka: seeing the footer) I think you could use this:

How to know when UITableView did scroll to bottom in iPhone

Community
  • 1
  • 1
Rui Peres
  • 25,741
  • 9
  • 87
  • 137