在同一视图中的 Core Data 中执行多次提取
我的 CD 商店设置完毕,一切正常。执行初始提取后,我需要使用第一次提取的数据根据计算执行多次提取。 Apple 提供的示例非常棒,帮助我让一切顺利进行,但我在执行连续的提取方面遇到了困难。如有任何建议或教程链接,我们将不胜感激。
- 表视图从 CD 存储加载数据。
- 当用户点击一行时,它会推送一个详细信息视图。
- 详细信息视图从 CD 加载详细信息。 [上述步骤全部有效]
- 我对详细视图中获取的数据执行了多项计算。
- 然后,我需要根据计算结果执行其他几次获取。
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 everything going but I'm struggling with executing successive fetches. Any suggestions, or tutorial links are appreciated.
- Table View loads data from CD store.
- When a user taps a row it pushes a detail view
- The detail view loads details from CD.
[THE ABOVE STEPS ARE ALL WORKING] - I perform several calculations on the data fetched in the detail view.
- I need to then perform several other fetches based on the results of my calculations.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的连续提取是针对已检索到的子集,那么您可以通过对从原始提取返回的
NSArray
调用-filteredArrayUsingPredicate:
来缩小搜索范围。更新
当您说其他几个提取时,您是想针对存储还是针对内存中已有的数据进行提取?
如果您需要针对存储进行提取,则没有什么可以阻止您通过实例化新的
NSFetchRequest
对象来执行其他提取。如果您正在获取内存中已有的数据,那么我上面的答案适用。
If your successive fetches are against the subset you already retrieved then you can narrow your searching by calling
-filteredArrayUsingPredicate:
upon theNSArray
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.