Revision: 23334
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 4, 2010 10:23 by espinallab
Initial Code
This will go over a quick run through of using NSUserDefaults. This is the class to use to save user preferences for example. It is pretty straight forward. Saving Data This is how you save data. NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; // saving a string [prefs setObject:@"test" forKey:@"stringVal"]; // saving a int [prefs setObject::23 forKey:@"intVal"]; // saving it all [prefs synchronize]; Loading Data NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; // getting the string stringVal = [prefs stringForKey:@"stringVal"]; // getting the int intVal = [prefs integerForKey:@"intVal"]; That is it.. pretty simple.
Initial URL
http://iphone.zcentric.com/?p=147
Initial Description
Initial Title
Saving and Loading NSUserDefaults
Initial Tags
Initial Language
Objective C