plist 如何遍历读取 数组 字典 ?
如何取出图中划线的数据呢?
回答:
+(void) testDictArray{
//writing
NSString *dictfilename=@"/Users/honeyshiny/Documents/dictarray.plist";
NSArray *dictarray=[NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:@"001[憨笑]",@"憨笑",nil],[NSDictionary dictionaryWithObjectsAndKeys:@"002[偷笑]",@"偷笑",nil], nil];
if([dictarray writeToFile:dictfilename atomically:YES]==NO)
{
NSLog(@"failed when saving dictionary into file");
}
//reading
NSArray *readingDictArray=[NSArray arrayWithContentsOfFile:dictfilename];
for(NSDictionary *dict in readingDictArray)
{
for(NSString *key in dict)
{
NSLog(@"%@>%@",key,[dict objectForKey:key]);
}
}
}
以上是 plist 如何遍历读取 数组 字典 ? 的全部内容, 来源链接: utcz.com/p/184615.html