2

Anybody know the kvc key/key path fore this code

[myArray objectAtIndex:i].property
Johnykutty
  • 12,091
  • 13
  • 59
  • 100

1 Answers1

4

Hmm, the closest you can go is probably:

[[myArray valueForKey:@"property"] objectAtIndex:i]

because arrays do not implement KVC for themselves, they redefine it to apply the key to the elements and return an array of the results.

Analog File
  • 5,280
  • 20
  • 23
  • It should be other way.. `[[myArray objectAtIndex:i] valueForKey:@"property"];` – Ilanchezhian Sep 21 '12 at 12:40
  • I know these methods is there any single keypath for that – Johnykutty Sep 21 '12 at 12:46
  • 1
    no. there cannot be as KVC with an array cannot access a single content object. It's either an array of results (one for each object), the array size, or an aggregate value on all content objects (like the maximum, minimum, average etc.). – Analog File Sep 21 '12 at 13:02