views:

25

answers:

1

Hello everyone,

At the moment i'm making an application where it is possible to make profiles with different settings. Which datatypes would you recommend me saving these information in?

I have a table which is showing the profile name and the version number. But for each profile there need to be stored more information.

Therefore the idea i'm working on have 2 arrays. 1 for all the profile information and 1 who is being made when loading the information. The second array is the one going to be showed in the table. Because the table doesnt show all the stored information.

.. but this seems kinda stupid. Is there a more suitable method for saving the information in like 1 array, and just pass part of the data to the tableview?

A: 

Well you can make your life easy and use a NSDictionary, and the part that you want to display to the user can be stored in a NSArray under a key in the dict. Using a dict has three advantages:

  1. It's free, no need to make a class for a simple task. Also very easy to hook up with bindings in your UI
  2. You can easily save it to disk in a PList file.
  3. This Plist file then is human readable. I wrote an app with themes/skins once, and users could just move the plist files to another computer to share or edit them by hand.

Another approach could be to use Core Data. You then have to define your own data model and implement the loading and saving of the profiles database. However, then you get undo/redo functionality and versioning very easily.

NSSplendid