0

NSDictionary結果タイプが次のコアデータフェッチリクエストの結果である辞書の配列があります。

request.resultType = NSDictionaryResultType;
request.returnsDistinctResults = YES;
request.propertiesToFetch = @[@"endCalYear",@"endMonth",@"periodLength"];

のサンプル結果NSArrayNSDictionary次のようになります。

{
    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つの)個別の配列を作成する最も効率的な方法は何ですかendCalYear = 2006、2007、2008; 与えられたNSArrayからのendMonth=3、9、12およびperiodLength = 3、6、12 ?

ありがとうございました!

4

1 に答える 1

2

使用できますvalueForKey

NSArray *endCalYearArray = [resultArray valueForKey:@"endCalYear"];
于 2012-10-18T12:01:45.667 に答える