Tag Archives: NSUserDefaults

How to remember the setting (user defaults) easily

NSUserDefautls object automatically loads and saves small information. Along with primitive value like BOOL, integer or float, NSUserDefaults can handle objects like NSArray, NSData, NSDictionary, NSString.

// Save a default
[[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"ShowWarning"];

// Read  BOOL warning value from NSUserDefaults
BOOL showWarning = [[NSUserDefaults standardUserDefaults] boolForKey:@"ShowWarning"];
Leave a comment Continue Reading →