2010年5月6日木曜日

NSExpression メモ

コード:

NSDictionary *d0= [NSDictionary dictionaryWithObjectsAndKeys:@"val10", @"key0", nil];
NSDictionary *d1= [NSDictionary dictionaryWithObjectsAndKeys:@"val11", @"key0", nil];
NSDictionary *d2= [NSDictionary dictionaryWithObjectsAndKeys:@"val02", @"key0", nil];
NSArray *anArray= [NSArray arrayWithObjects:d0, d1, d2, nil];

NSExpression* expression = [NSExpression expressionForKeyPath:@"key0"];

id result= [expression expressionValueWithObject:anArray
context:nil];
NSLog(@"result: %@", result);


結果:

result: (
val10,
val11,
val02
)

0 件のコメント: