Objective c 基于包含字典的NSArray创建新数组

Objective c 基于包含字典的NSArray创建新数组,objective-c,ios,arrays,nsarray,nsdictionary,Objective C,Ios,Arrays,Nsarray,Nsdictionary,我有一个字典数组,它来自一个核心数据获取请求,结果类型为NSDictionary: request.resultType = NSDictionaryResultType; request.returnsDistinctResults = YES; request.propertiesToFetch = @[@"endCalYear",@"endMonth",@"periodLength"]; NSDictionary的示例结果NSArray如下所示: { endCalYear = 2

我有一个字典数组,它来自一个核心数据获取请求,结果类型为
NSDictionary

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;
}
创建(三)个独立阵列的最有效方法是什么结束月份=3,9,12和周期长度=3,6,12,从给定的NSArray开始


谢谢大家!

您可以使用
valueForKey

NSArray *endCalYearArray = [resultArray valueForKey:@"endCalYear"];

谢谢你,马丁!是否可以访问特定的基于索引的值而不首先创建NSArray,例如返回“endCalYear”中的第二项,这将导致2007年(即组合
valueForKey
和索引?@AlexR:
[[resultArray objectAtIndex:i]objectForKey:@“endCalYear”]