zoukankan      html  css  js  c++  java
  • Plist读取写入

     1     //读取plist文件的数据
     2     NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"province" ofType:@"plist"];
     3     NSMutableDictionary *data = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
     4 //    NSLog(@"%@", data);//直接打印数据。
     5 //    NSLog(@"%ld",data.count);
     6     
     7     
     8     //向plist文件写入。。。。。暂时只需要读,先不看。。。
     9     //添加一项内容
    10 //    [data setObject:@"add some content" forKey:@"c_key"];
    11 //    
    12 //    //获取应用程序沙盒的Documents目录
    13 //    NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
    14 //    NSString *plistPath1 = [paths objectAtIndex:0];
    15 //    
    16 //    //得到完整的文件名
    17 //    NSString *filename=[plistPath1 stringByAppendingPathComponent:@"team.plist"];
    18 //    //输入写入
    19 //    [data writeToFile:filename atomically:YES];
    20 //    
    21 //    //那怎么证明我的数据写入了呢?读出来看看
    22 //    NSMutableDictionary *data1 = [[NSMutableDictionary alloc] initWithContentsOfFile:filename];
    23 //    NSLog(@"%@", data1);
    24 // 
  • 相关阅读:
    FCC学习笔记(二)
    FCC学习笔记(一)
    jQuery(三)
    jQuery(二)
    jQuery(一)
    JavaScript(九)
    JavaScript(八)
    2-1回归算法
    14-章小结
    13-模型训练及测试
  • 原文地址:https://www.cnblogs.com/vector11248/p/7678407.html
Copyright © 2011-2022 走看看