I have created window based application. Tab bar controller as root controller and it has three tabs. One Tab has Labels and TextField inputs like Name, Username and Password.
I am looking to store this text filed inputs when user enters and able retrieve in other tabs.
Previously I have set key for different text fields and setobject:withkey task and able to retrieve text filed values in same view Controller [[NSUserDefaults standardUserDefaults] stringForKey:key] task. Now I am looking to create database which has different object开发者_JAVA百科s and each objects has data values of different Text Field inputs that I can access in whole application. like DatabaseName -> Object1 -> Name, Username & Password -> Object2 -> Name, Username & Password Something like structure in Normal C so it would be easy to retrieve data.
I am looking NSUserDefaults Class and User Defaults Programming Topics in Cocoa(http://developer.apple.com/iPhone/library/documentation/Cocoa/Conceptual/UserDefaults/UserDefaults.html#//apple_ref/doc/uid/10000059-BCIDJFHD).
Also Referring Archives and Serialization Programming guide : https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Archiving/Archiving.html. Which method do I need to use to create such type of database ?
If you're just saving a small array of a limited size, then using NSUserDefaults like this is probably ok.
If it's truly a "database" that may contain a large number of objects and/or change frequently, most people would probably recommend that you use Core Data instead.
精彩评论