开发者

iPhone - pull data directly from a database to tableview cells?

开发者 https://www.devze.com 2023-03-26 00:43 出处:网络
I currently have an application with a tableview, I\'ve followed the basic tutorials and use an NSArray and NSDictionary that I populate myself and use this to populate the cells in the tableview.

I currently have an application with a tableview, I've followed the basic tutorials and use an NSArray and NSDictionary that I populate myself and use this to populate the cells in the tableview.

I have also been able to create a test database and I can pull the information from here into an array and again add this array to an NSDictionary and populate the data in the cells of the tableview.

However it doesn't make sense to me that I have to copy the data from my database into memory (array) and then use this to populate the cells, is there a way to populate the cells of a tableview without needing to use an Array and dictionary and instead access the in开发者_如何学Cfo for each cell directly from the database?

Or is pulling data from the database into memory and using it from there the recommended way?


Take a look at the Core Data Programming Guide. Core Data uses so-called "faults", that aren't fired until you access them. Additionally, Apple provides a NSFetchedResultsController to manage a UITableView with a Core Data-based database.

0

精彩评论

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