views:

61

answers:

1

I have an array of arrays that I want to use KVC on (at least I think I do -- it seems like the most straightforward way) but I can't figure out how to create keypaths for individual array indexes. My array looks like this

NSArray [

NSArray[0, 1, 2, 3], NSArray[4, 5, 6, 7], NSArray[8, 9, 10, 11]

]

What I want to do is get the maximum value of index 3 in the inner array. It seems like something like [outerArray valueForKey:@"@max.[3]"] would work, but I can't figure out the syntax, and my Googling has been fruitless as well. Is what I'm trying to do even possible, or should I just write a method to do this manually?

+3  A: 

Most people expect this to be there, but KVC really doesn't allow addressing individual indexes of an array. You can operate on the whole array or transformations of the array (e.g, @distinctUnionOfArrays) but you can't address individual elements. You'll have to do it "by hand," so to speak.

Chuck
Doh! Thanks for the answer, though :)
John Biesnecker