问题描述
开始与Core Data一起工作,虽然我已经弄清楚如何在常规Cocoa应用程序中使用它,它似乎在Cocoa Touch中有点不同。
Been starting to work with Core Data a bit, and while I've figured out how to use it in regular Cocoa applications, it seems it works a bit differently in Cocoa Touch. How do you bind entities to objects such as table cells in Cocoa Touch?
推荐答案
如果您在iPhone OS 3.0上使用CoreData以上,您将需要查看 NSFetchedResultsController
。虽然不是真正的模拟 NSArrayController
,它是专门设计用于 UITableView
及其控制器。
If you're using CoreData on iPhone OS 3.0 and above, you'll want to look at NSFetchedResultsController
. While not really an analog to NSArrayController
, it is designed specifically to be used with UITableView
and its controller.
它提供了一种根据需要从持久性加载元素的方法,记住设备的性能和内存限制。它不像简单的绑定的东西那么干净,但它可能会用少量的代码来完成你需要的一切(和更多!)。
It provides a way to load elements from persistence as needed, keeping in mind performance and memory constraints of the device. It's not as clean as simply binding things, but it will probably do everything you need (and more!) with a small amount of code.
这篇关于什么是Cocoa Touch相当于NSArrayController?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!