moja
moja

Reputation: 13

Create NSArray From Objects in NSMutableArray

I have NSMutableArray with 10,000 objects, each object has Name, Details, ...etc. I want to Create an NSArray Which contains ONLY the Names of all objects.

Upvotes: 0

Views: 264

Answers (1)

Paul.s
Paul.s

Reputation: 38728

Use KVC

NSArray *names = [myArray valueForKey:@"name"];

Check the docs for NSArray

valueForKey:
Returns an array containing the results of invoking valueForKey: using key on each of the array's objects.

Upvotes: 7

Related Questions