In my App i am loading the table with events (from server), where i am sorting them by date wise and showing in sections with header title as the date of event. Now my requirement is(because of lot of records) to load 20 by 20 records and they must be in sorted order with sections.
Share
I assume that you are loading data with Rest web service. Somewhere on server you need to have an SQL statement to load events
Where page is the number of page you are loading.
Your iPhone app will start with:
1- int page = 0;
2- Create a NSMutableDictionary to store all events retrieved by page.
3- Sending request to the REST resource with post method and a page parameter (page = 0).
4- We are sure to get 20 (or less) events.
5- for each new event data, create an NSMutableArray and store it on our mutable dictionary with the key the event date.
6- Whenever adding new event to the dictionary, check if the dictionary has a key with this event date, if yes add the event to the mutable array with that key, else create new mutable array and add the event to it then add it to the dictionary with the event date.
7- Display the table view with header titles the keys, number of section:
8- load next page:
8-a- page++
8-b send request with the new page value
8-c add new events to the Mutable dictionary that contains already the 20 first events;
8-d reload data on table view