Search code examples
objective-ckey-value-codingkvc

[myArray objectAtIndex:i].property in kvc


Anybody know the kvc key/key path fore this code

[myArray objectAtIndex:i].property

Solution

  • 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.