I have 10,000 rows in database table. I have a view which is suppose to list all these rows in a tableview. But loading all in one shot takes ages to appear in tableview.
How can we use "Load More Records" feature which will fetch 20 records at a time? If user wants to view more entries, they can click "Load More Records" button and it will show next 20 records.
Will have to modify my select statement? What other changes do I have to do to achieve this?
Thanks everyone for your inputs. But I was able to implement this using below link:
http://useyourloaf.com/blog/2010/10/2/dynamically-loading-new-rows-into-a-table.html
Hope this is useful to all.
@meetpd its not an answer just a suggestion.
You can use
core data
instead ofsqlite
. it will satisfy your requirement of fetching 20 records. It will reduce your code base to 40% (as said by Bard Larson in the Advance Iphone App Development). It is easy to use and faster than sqlite. You can check out the sample code like this :hope this will help you a great deal of coding.
UITableView reuses its cells. This means you can dynamically access your database when
cellForRowAtIndexPath:
is called- you don't need to load all 10000 elements at once, nor should you. I hope this helps, and that I'm not misunderstanding your question.This is pretty basic UITableView stuff, but it should get you started. Sorry I don't know much about either Core Data or SQLite.