iOS开发:Plist文件读写。1、读取+写入plist;2、根据plist节点内容创建UITab
答案:1 悬赏:60 手机版
解决时间 2021-03-07 20:24
- 提问者网友:饥饿走向夜
- 2021-03-07 10:21
iOS开发:Plist文件读写。1、读取+写入plist;2、根据plist节点内容创建UITab
最佳答案
- 五星知识达人网友:过活
- 2021-03-07 10:30
//获取plist地址
NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"UpgradeDataArray" ofType:@"plist"];
NSMutableDictionary *dataDic = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath]; //根据你存入的类型取出对应的数据。
//添加一项内容
[dataDic setObject:arr forKey:@"upgradeData"];
//获取应用程序沙盒的Documents目录
NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *plistPath1 = [paths objectAtIndex:0];
//得到完整的文件名
NSString *filename=[plistPath1 stringByAppendingPathComponent:@"UpgradeDataArray.plist"];
//输入写入
BOOL fl = [dataDic writeToFile:filename atomically:YES]; //写入
提问容易,回答不易,且问且采纳!!
NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"UpgradeDataArray" ofType:@"plist"];
NSMutableDictionary *dataDic = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath]; //根据你存入的类型取出对应的数据。
//添加一项内容
[dataDic setObject:arr forKey:@"upgradeData"];
//获取应用程序沙盒的Documents目录
NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *plistPath1 = [paths objectAtIndex:0];
//得到完整的文件名
NSString *filename=[plistPath1 stringByAppendingPathComponent:@"UpgradeDataArray.plist"];
//输入写入
BOOL fl = [dataDic writeToFile:filename atomically:YES]; //写入
提问容易,回答不易,且问且采纳!!
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯