0
我有字典的阵列,其从核心数据读取请求的结果与结果类型的NSDictionary
:创建基于NSArray的新的阵列,其包含词典
request.resultType = NSDictionaryResultType;
request.returnsDistinctResults = YES;
request.propertiesToFetch = @[@"endCalYear",@"endMonth",@"periodLength"];
的样品结果的NSDictionary
NSArray
看起来如下:
{
endCalYear = 2007;
endMonth = 12;
periodLength = 12;
},
{
endCalYear = 2006;
endMonth = 9;
periodLength = 3;
},
{
endCalYear = 2006;
endMonth = 6;
periodLength = 3;
},
{
endCalYear = 2006;
endMonth = 3;
periodLength = 3;
}
什么是最有效的方式来创建(三级)独立阵列endCalYear = 2006,2007,2008; endMonth = 3,9,12和periodLength = 3,6,12从NSArray给出?
谢谢!
谢谢,马丁!如果没有首先创建一个NSArray,例如返回“endCalYear”中的第二个项目,这会导致2007年(即将“valueForKey”和索引? – AlexR
@AlexR:'[ [resultArray objectAtIndex:i] objectForKey:@“endCalYear”]' –