3

我有一个在 NSLog 中输出的数组:

log: (
        {
        "case_color" = White;
        "case_description" = "";
        "case_image" = "http://site.com/get/parts/part_images/nzxtphantom410.jpeg";
        "case_name" = "NZXT Phantom 410";
        "case_price" = "99.99";
        "case_type" = ATX;
        id = 1;
    }
)

我怎样才能把它放在一个 NSDictionary 中,所以我可以这样称呼它:

NSDictionary *object;
NSString *casename object[@"case_name"];

并且casename等于“NZXT Phantom 410”

4

1 回答 1

5

看起来您的数组只有一个元素,即字典。试试这个:

NSDictionary *dictionary = [myArray objectAtIndex:0];
NSString *caseName = [dictionary objectForKey:@"case_name"];
于 2012-08-17T20:52:22.857 回答