NSDictionary的几种遍历方法:
1、NSEnumerator
NSEnumerator* keyEnum = [iDictionary keyEnumerator];id key;for(key = [keyEnum nextObject]){ //do something;}
2、for key in ...
for (id key in iDictionary){ //do something}
3、NSDictionary allKeys
- (void)describeDictionary:(NSDictionary *dict){ NSArray *keys; int i, count; id key, value; keys = [dict allKeys]; count = [keys count]; for (i = 0; i < count; i++) { key = [keys objectAtIndex: i]; value = [dict objectForKey: key]; NSLog (@"Key: %@ for value: %@", key, value); }}