开发者

uitableview question - preserving data?

how is it possible to preserve data in an uitablevi开发者_如何转开发ew when the application quits? so the original information is still retained?


For that you will need some sort of persistence manager; it won't "just work" the way you have set it up now.

One way is to use Core Data - Apple has good documentation on this and their TableView template can use CoreData for data storage.


You mean you want to save the datasource of your tableview when the application exits? In that case, in your applicationWillTerminate, save your datasource to a persistent memory. Depending on the amount of data you want stored, you can decide on NSUserDefaults, CoreData, sqlite database or even a remote storage where you can send your data via a webservice.


Another vote for Core Data. It's very easy to work with and will allow you to persist your data in real time as it changes in your app.

I recommend against only persisting your data when the app exits. iOS apps can be put in the background and/or terminated at any time based on external events (home button, phone calls, notification interactions, etc) or your app could crash. If you use core data properly and save the managed object context whenever data changes your users will have a great experience.

http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/cdProgrammingGuide.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜