码迷,mamicode.com
首页 > 其他好文 > 详细

plist保存不同的数据

时间:2016-04-27 01:35:35      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:

FDrugsPath =[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0] stringByAppendingPathComponent:@"favoriteDrug.plist"]

    

    NSMutableDictionary* resultDict = [NSMutableDictionary dictionaryWithContentsOfFile:FDrugsPath];

    if (!resultDict) {

        resultDict = [NSMutableDictionary dictionary];

    }

    //self.drugDetail.name是从第一个页面传过来的药品名字

    [resultDict setObject:self.drugDetail.name forKey:@(resultDict.allKeys.count+1).stringValue];

    NSLog(@"resultDict -- %@",resultDict);

    [resultDict writeToFile:FDrugsPath atomically:YES];

plist保存不同的数据

标签:

原文地址:http://www.cnblogs.com/liuxingchen/p/5437207.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!