views:

13

answers:

1

HI All,

I currently have an NSFetchedResultsController setup to return all rows in a table in my core data database. This then fills up my UITableView. The trouble is this will quickly get out of hand as the rows grow in number.

How can I limit the initial query to say 20 results, then add a button somewhere to "Get More" from where we left off?

Thanks for any guidance as always

+1  A: 

This is controlled with NSFetchRequest's -setFetchLimit: and -setFetchOffSet.

If I recall correctly, the drawback with NSFetchedResultsController is that you can't modify the fetch request after you create your NSFetchedResultsController instance. I believe this means you'll have to create a new one (instance w/new fetch request) each time you change the range you want to retrieve/display.

File an enhancement request with Apple at bugreporter.apple.com if you feel this shouldn't be the case.

Joshua Nozzi
sounds messy... how much data is safe to return in an NSFetchedResultsController? Perhaps I could filter from the fetch request somehow... Can it handle thousands of rows? Just so I can get an idea... imagine my row has 4-5 attributes with small amounts of data... a few bytes.
mootymoots
I haven't tested anything specific and those metrics probably wouldn't mean much to you since it's doubtful our models would behave similarly. Best to pick a number (any number) and profile it.
Joshua Nozzi