开发者

Performing multiple fetches in Core Data within the same view

I have my CD store setup and everything is working. Once my initial fetch is performed, I need to perform several fetches based on calculations using the data from my first fetch. The examples provided from Apple are great, and helped me get everyt开发者_如何学Pythonhing going but I'm struggling with executing successive fetches. Any suggestions, or tutorial links are appreciated.

  1. Table View loads data from CD store.
  2. When a user taps a row it pushes a detail view
  3. The detail view loads details from CD. [THE ABOVE STEPS ARE ALL WORKING]
  4. I perform several calculations on the data fetched in the detail view.
  5. I need to then perform several other fetches based on the results of my calculations.


If your successive fetches are against the subset you already retrieved then you can narrow your searching by calling -filteredArrayUsingPredicate: upon the NSArray that is returned from the original fetch.

update

When you say several other fetches, are you wanting to fetch against the store or against the data you already have in memory?

If you need to fetch against the store, there is nothing stopping you from performing additional fetches by instantiating new NSFetchRequest objects.

If you are fetching against the data you already have in memory then my answer above applies.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜