iphone - Is there a better way to put a bunch of stuff in NSUserDefaults? -
I'm confused about the NSUserDefaults
on the iPhone.
C / ASM has a learning experience from background and objective content.
I am currently using NSUserDefaults
to store some strings (for the name in the highest table). I want to start implementing a "save game" feature so that the user gets a call or he can get it out of the game for a moment, then they can come back.
To recover the game, they have received some BOOL
flag, some int
s to store some required variables, but I'm stuck in an array that needs to be stored.
I have a 50 element array of unsigned char
s, I can move it to int
s if it makes things easier, but I'm not looking at this setBool
(already doing) to work with setBool
, setFloat
(again, before To work with), go to setInteger
, and setObject
.
Obviously, I can declare the key to every element of the array and they have setInteger
but this is actually the best way to deal with this. Instead of an array of unsigned chars, do I try to use a
NSObject
in any way? Are there any good tutorials on NSObject
that I can read to understand it better?
What better fit with the list of assets you are trying to achieve?
You can create dictionary, store prices for each setting or an array, and then dump it into the property list. You can easily read them back or update prices based on key. can do.
Comments
Post a Comment