iOS plist
2016-05-27 13:11
323 查看
//存
NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *path=[paths objectAtIndex:0];
NSLog(@"path = %@",path);
NSString *filename=[path stringByAppendingPathComponent:@"test.plist"];
NSFileManager* fm = [NSFileManager defaultManager];
[fm createFileAtPath:filename contents:nil attributes:nil];
//创建一个dic,写到plist文件里
NSDictionary* dic = @{@"image":str};
NSLog(@"dic----%@",dic);
[dic writeToFile:filename atomically:YES];
//取
NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *path=[paths objectAtIndex:0];
NSString *filename=[path stringByAppendingPathComponent:@"test.plist"];
NSDictionary* dic2 = [NSDictionary dictionaryWithContentsOfFile:filename];
NSLog(@"dic2---%@",dic2);
NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *path=[paths objectAtIndex:0];
NSLog(@"path = %@",path);
NSString *filename=[path stringByAppendingPathComponent:@"test.plist"];
NSFileManager* fm = [NSFileManager defaultManager];
[fm createFileAtPath:filename contents:nil attributes:nil];
//创建一个dic,写到plist文件里
NSDictionary* dic = @{@"image":str};
NSLog(@"dic----%@",dic);
[dic writeToFile:filename atomically:YES];
//取
NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *path=[paths objectAtIndex:0];
NSString *filename=[path stringByAppendingPathComponent:@"test.plist"];
NSDictionary* dic2 = [NSDictionary dictionaryWithContentsOfFile:filename];
NSLog(@"dic2---%@",dic2);
相关文章推荐
- iOS开发中(Xcode)常见报错和解决办法
- iOS中显示GIF动画
- iOS项目中引用多个第三方库引发冲突的解决方法
- iOS 通讯录详解
- Nagios页面介绍(四)
- iOS 开发中的争议(一)类的成员变量应该如何定义?
- iOS中--NSArray调用方法详解 (李洪强)
- ios avfoundation 合并音频到一个视频文件 avurlassettrack
- iOS 自定义二维码条形码扫描识别
- iOS程序中的内存分配 栈区堆区全局区
- iOS 对afnetworking简单封装
- iOS版本控制工具(SVN,GIT,SourceTree)
- iOS Quartz2D使用(绘图路径)
- iOS 工具类
- IOS 自定义 无限图片轮播器开源库
- iOS 自定义照相机
- iOS知识---针对多个显示内容空间不定内容长度的显示问题Content Hugging 和 Content Compression Resistance
- iOS AVCaptureSession实现获取摄像头图像,并识别图片中身份证号码
- iOS 画字,画线,矩形,画图,动画
- ios 对FMDB 简单封装