PassionateDeveloper
PassionateDeveloper

Reputation: 15158

UITableView -> How to load additional entry on scroll down?

I want to load my data on scroll down for my tableView.

I have a JSON API from where I get my data. Its a Private Message System. Everytime I will get 20 entries, I can select a page (0 to x) get the first to x entries (everytime 20 entries). So at the moment I have my table and I load a list of 20 entries and show them.

Now I want to have as soon as I reach the last entry it should load the next 20 entries.

I try to read many things about it here on StakcOVerflow and look at a Github Project with this but don't understand it at all. Can someone tell me how to do this?

Upvotes: 5

Views: 9740

Answers (2)

Vignesh
Vignesh

Reputation: 10251

You can use the willDisplayCell method of UITableview. For ex, to see whether a row has 'load-more' button if you have one.

See this post.

A Github project.

Upvotes: 9

touti
touti

Reputation: 1164

you can implement this delegate

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
//put data on your array
[tableView reloadData];
}

Upvotes: 3

Related Questions