标签:stand suse 保存数据 auto str erp member ast standard
-(void)touchesBegan:(NSSet*)touches withEvent:(UIEvent *)event
{
NSString *doc = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSLog(@"%@",doc);
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
// NSLog(@"%@",doc);
//保存数据
[defaults setObject:@"zhangsan" forKey:@"account"];
[defaults setObject:@"123" forKey:@"passwd"];
[defaults setBool:YES forKey:@"autoLogin"];
[defaults setBool:YES forKey:@"rememberPwd"];
//调用同步方法,把数据保存到沙盒文件中
[defaults synchronize];
NSString *name = [defaults objectForKey:@"account"];
NSString *password = [defaults objectForKey:@"passwd"];
NSLog(@"%@, %@", name, password);
}
标签:stand suse 保存数据 auto str erp member ast standard
原文地址:http://www.cnblogs.com/1018475062qq/p/6241485.html