Tom
Tom

Reputation: 2418

access all indexes in NSMutbleArray

Does anybody know how to access all index's and not just a specific for a certain key

ie[[anArray objectAtIndex:indexPath.row]objectForKey:@"Number"]

i want [[anArray objectAtIndex:ALL ROWS]objectForKey:@"Number"]

Thanks :)

Upvotes: 0

Views: 55

Answers (2)

Amit Battan
Amit Battan

Reputation: 3018

you can use valueForKey

 [array valueForKey:@"key"];

Upvotes: 0

Vladimir
Vladimir

Reputation: 170859

You can use -valueForKey: method of NSArray:

NSArray* numbersArray = [anArray valueForKey:@"Number"];

This method returns an array containing results of -valueForKey: called on each element of array (putting NSNull object in case that result is nil).

Upvotes: 2

Related Questions