How to implement “Load 25 More” in UITableViewController?

Just put a button connected to an Event in your table footer. When the button is clicked, append the next 25 results to your already existing array of items After that, just do a self. TableView setNeedsDisplay.

I use that to let my table know I have extra data in the table. By using that, there is no need to scroll to the right line in the table, because it keeps its original position Also, why call the viewDidAppear method, this seems wrong to me, because (ofcourse) the view already appeared and all declerations and assignments you do there are re-done. Just put the stuff you need to be done while viewing the view AND when you are appending data in a seperate method and put call that method from your button-press event and from the viewDidAppear event.

Just put a button connected to an Event in your table footer. When the button is clicked, append the next 25 results to your already existing array of items. After that, just do a self.

TableView setNeedsDisplay. I use that to let my table know I have extra data in the table. By using that, there is no need to scroll to the right line in the table, because it keeps its original position.

Also, why call the viewDidAppear method, this seems wrong to me, because (ofcourse) the view already appeared and all declerations and assignments you do there are re-done. Just put the stuff you need to be done while viewing the view AND when you are appending data in a seperate method and put call that method from your button-press event and from the viewDidAppear event.

Thank you very much for your reply. Sounds like a good approach. Exactly what I'm looking for.

I'll give it a try and update you when done. – Leo May 10 '10 at 10:21 Ow, also, for appending an array to your already existing array: yourCurrentArray addObjectsFromArray:newArray; The newArray can contain (for example) newly fetched results. – Wim Haanstra May 10 '10 at 10:56 Brilliant!

Thanks – Leo May 10 '10 at 11:44.

I do almost the same in my application, getting 50 first records from webservice. As a table footer I have a view with next/previous buttons, that when pressed launch a fetching request for next/previous 50 results. After fetch request is processed I call viewWillAppear:animated: for my view controller and inside to self.

TableView reloadData, so these results show up in the same table view. Of cause I'm keeping the data each time only for presented results, but it depends on your needs. Hope this helps.

– Leo May 10 '10 at 8:01 In my case it replaces them, since I use the same array, so before I parse next 50 results I clean the array. So it doesn't append results, rather overrides them – Nava Carmon May 10 '10 at 9:04 Thanks for your reply. Really appreciate that.

Do you have any idea how can we achieve the appending? – Leo May 10 '10 at 9:07 You can append data to your existing results array. Just don't forget to update the number of rows accordingly, since reloadData method rebuilds the table.

Also, you probably will want to present next 25 results, so you should keep a 0-based currentPage variable and update it accordingly each time you go forward/back. In viewWillAppear and a function: self. TableView scrollToRowAtIndexPath:NSIndexPath indexPathForRow:0 inSection:0 atScrollPosition:UITableViewScrollPositionTop animated:YES; where a row will be currentPage*NUM_ROWS_IN_PAGE (25 in your case).

– Nava Carmon May 10 '10 at 9:26 Thank you very much for your reply. Certainly pointing to the right direction. – Leo May 10 '10 at 10:20.

I wrote an example project that does this which you can download from GitHub https://github. Com/Abizern/PartialTable.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions