I have an NSDictionary and want to iterate over the objects. But at the same time, I need to know the key of the dictionary.
I remember there was a special, fancy form of fast enumeration, but have forgotten the exact syntax.
Anyone?
I have an NSDictionary and want to iterate over the objects. But at the same time, I need to know the key of the dictionary.
I remember there was a special, fancy form of fast enumeration, but have forgotten the exact syntax.
Anyone?
for (id key in mydictionary) {
id mything = [mydictionary objectForKey:key];
}
I think what you want is something like this:
for (id key in dictionary) {
NSLog(@"key: %@, value: %@", key, [dictionary objectForKey:key]);
}
Taken from here.
keyEnumerator returns an object that lets you iterate through each of the keys in the dictionary. From here