陈斌彬的技术博客

Stay foolish,stay hungry

NSDictionary的遍历

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);
  }
}