假设我有两个具有相同键但值不同的NSDictionaries。我需要使用Dictionary 1的键找到Dictionary 2的值。
示例
MYDictionaryONE
{
58937 = {
Changed = NO;
ChangedColorCode = Nil;
};
58859 = {
Changed = NO;
ChangedColorCode = Nil;
};
}
MYDictionaryTWO
{
58937 = {
pass = YES;
Fail=Nil;
};
58859 = {
pass = YES;
Fail = Nil;
};
}
我只想一次从MYDictionaryONE获取一个键,并在MYDictionaryTWO中搜索与该键相关的值。我尝试存储所有键但我错过了逻辑
答案 0 :(得分:1)
尝试以下代码段。
NSArray *allKeys = [MYDictionaryONE allKeys];
for(int i = 0; i < allKeys.count; i++)
{
NSString *key = allKeys[i];
id object = MYDictionaryTWO[key];
}