NSUserDefaults 本地小量数据存储
2015-10-13 08:40
253 查看
1.在注册界面点击事件 把数据存进去
NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:_ac1.text,@"name",_pw1.text,@"password", nil];
[user setObject:dic forKey:@"user"];
[self.navigationController popViewControllerAnimated:YES];
2.在登录界面 点击事件里 把数据取出来
NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
NSDictionary *dic = [user objectForKey:@"user"];
if ([_oneV.aa.text isEqualToString:[dic objectForKey:@"name"]] && [_oneV.bb.text isEqualToString:[dic objectForKey:@"passwaord"]]) {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"提示" message:@" 登录成功" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
}else{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"提示" message:@"登录失败" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定 ", nil];
[alert show];
}
相关文章推荐
- C 从标准输入读取字符串.
- 手机验证短信设计与代码实现
- 别说什么“寒门再难出贵子”,屌丝逆袭从来都是极少数
- #蓝懿ios学习的日子#2015年10月12鈤
- 国产游戏机起步曾经很强大 它叫中华学习机
- 备份:创建VS工程使用神经网络库——FANN
- codeforces 586B:Laurenty and Shop
- Spring相框:AOP详细说明
- codeforces 586B:Laurenty and Shop
- Core Location Manager Changes in iOS 8 英文文档
- ZOJ 2165 Red and Black(DFS,水题)
- iOS 刘国斌,蓝懿刘国斌
- struts2 拦截器
- MBProgressHUD 的使用
- [转载] 淘宝内部分享:怎么跳出MySQL的10个大坑(上)
- Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (k
- 明星投资五花八门,未来将呈现何种趋势?
- 判断一个字符串是否在一个字符串数组里
- CentOS 6.5 安装 Nginx 1.7.8 教程
- 敏捷开发本质 与 敏捷个人本质