Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 793
PassionateDeveloper Avatar asked Apr 04 '12 08:04

PassionateDeveloper


2 Answers

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.

like image 77
Vignesh Avatar answered Oct 28 '22 14:10

Vignesh


you can implement this delegate

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
//put data on your array
[tableView reloadData];
}
like image 21
touti Avatar answered Oct 28 '22 15:10

touti