Query on Pagination Implementation in a UITableView
I am intending to implement pagination in a tableview.
Currently, I am using the following method to retrieve a JSON file from the server
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://allPhotos.com/photos.json"]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
I was wondering if anyone can advise me on the following:
1) How can I implement pagination like what we have in the iPhone app store where the table will load the next set of cells only if the user clicks on the cell with the text 'Twenty Five More..."
2) What kind of commands do I need to send to the server so that it will return me only a开发者_高级运维 subset of the items in the JSON file?
You can add some parameter to your URL. maybe like this
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://allPhotos.com/photos.php?page=1"]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
evertime that user click more button, you keep increasing page number. Your server will also have to perform some server-side codes such as check the value of page and return a subset of json file.
精彩评论