// 1
NSDictionary *dic = @{@"8":@"AAAA",
@"2":@"BBBBB",
@"3":@"CCCCCC",
@"1":@"FFFFF"};
NSArray *arrKeys = [dic allKeys];
for (int i = 0 ; i < arrKeys.count ; i++)
{
NSString *key = arrKeys[i];
NSString *value = [dic valueForKey:key];
NSLog(@"%@ = %@",key,value);
}
NSLog(@"%zd",dic.count);
// 2
[dic enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
NSLog(@"key = %@ and obj = %@", key, obj);
}];
网友评论