Edit: I've found a better solution than the answers I previously posted
NSArray* names = [peopleArray valueForKey: @"name"];
Sends -name to every element of peopleArray and builds a new array of the results
Documentation
One way, use fast enumeration:
NSMutableArray* nameArray = [[NSMutableArray alloc] init];
for (Person* person in peopleArray)
{
[nameArray addObject: [person name]];
}
Another way, to distinguish my answer from the identical one posted just before mine :-)
Create a method on Person called addNameToArray: and use makeObjectsPerformSelector:
// Person.m
-(void) addNameToArray: (id) aMutableArray
{
[aMutableArray addObject: [self name]];
}
// where you want to add the names
NSMutableArray* nameArray = [[NSMutableArray alloc] init];
[peopleArray makeObjectsPerformSelector: @selector(addNameToArray:) withObject: nameArray];
Disappointingly there seems to be no equivalent to the map function.