1

I have an array like this:


NSArray* myArray=[NSArray arrayWithObjects:
                      [NSDictionary dictionaryWithObjectsAndKeys:@"123",@"imageid",@"Jeff",@"imagename", nil],
                      [NSDictionary dictionaryWithObjectsAndKeys:@"234",@"imageid",@"Sophie",@"imagename", nil],
                      [NSDictionary dictionaryWithObjectsAndKeys:@"456",@"imageid",@"David",@"imagename", nil]
                      , nil];

I wanna get a target array which contains like :
{ 123,234,456 }
How to do this using NSPredicate

uspython
  • 483
  • 5
  • 18

1 Answers1

3

Try this. You may not need NSPredicate for this.

NSArray *targetArray = [myArray valueForKey:@"imageid"];

Update: For better understanding of valueForKey, please refer apple documentation of NSArray

iDev
  • 23,310
  • 7
  • 60
  • 85