如何读取plist文件的子元素

时间:2014-02-06 05:38:18

标签: ios objective-c plist

我有一个像这样的plist文件现在我想访问低于5K的所有三个元素(第0项,第1项,第2项),我想将它存储在数组中。我怎样才能做到这一点 ?如果有人知道解决方案,请帮我解决这个问题。如果有任何不明确的地方,请发表您的意见,我将重播。

提前致谢。

enter image description here

支出表格。

enter image description here

我使用的代码

-(void)selectLevel
{
    plistPath = [[NSBundle mainBundle] pathForResource:@"Planlist" ofType:@"plist"];

    NSMutableDictionary * Plist = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];

    NSMutableDictionary * specific;

   NSArray * leveldata = [Plist objectForKey:@"5K"];

    NSArray *complexity = [leveldata objectAtIndex:1];

     NSLog(@"++++++++%@",complexity);

    for (int i=0; i<3; i++) {
        specific =(NSMutableDictionary *)[leveldata objectAtIndex:i];
         NSLog(@"-------%@",specific);
    }

    NSLog(@"=======-%@",[specific allKeys]);
}

表示我正在接受

enter image description here

0 个答案:

没有答案