其实NSUserDefaults就像一个NSDictionary一样。
例如:
01.NSString *string = [NSString stringWithString @"hahaha"];
02.NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];//初始化NSUserDefault
03.[ud setObject:string forKey:@"myKey"]; //添加键值
04.NSString *value;
05.value = [ud objectForKey:"myKey"]; //通过key获取值
但是并不是所有的东西都能往里放的。NSUserDefaults只支持: NSString, NSNumber, NSDate, NSArray, NSDictionary.