views:

1010

answers:

2
+1  A: 

You need to call objectForKey: on the dictionary to get one of the arrays, and then call objectAtIndex:0 (or just lastObject) on the array to get the string. You can combine these two method calls into one line of code, for example:

[[dictionary objectForKey:@"All Items"] lastObject];
Marc Charbonneau
I think he wants them all... that's just the same as what he did except using lastObject instead of objectAtIndex:0.
Jason Coco
I guess I need to clarify further. I'm trying to avoid using hard-coded strings like in objectForKey. The whole idea is to allow for the possibility of changing the content of the plist without having to also make a code change. What I'm trying to do with the above data is populate a table view cell.text (with the key values) and use the 'buried' string values (like 'find.png') to add an image to cell.image via UIImage imageNamed.
kindaran
The reference to lastObject does help a bit, although still not the most elegant way I'd like to do this.
kindaran
Then don't use an array. Use a string as a key and a string as a value. Then you can just get all the keys either through fast enumeration or the allKeys message and use objectForKey with the variable key to populate the view.
Jason Coco
A: 

You can use the fast enumeration of the dictionary:

for (id key in dict) {
    NSArray *array = [dict objectForKey:key];
    NSLog(@"key: %@, value: %@", key, [array objectAtIndex:0]);
}
Alexandre L Telles