vikasch90
vikasch90

Reputation: 3

Retrieve elements from an array in a dictionary

I am new to objective C and I really need help with the following problem. I have a dictionary userDetails which contains array userAttributes

 int y=0;
 for (int z=0;z<noOfNeighbours;z++) {
NSMutableArray *userAttributes = [userDetails objectForKey:[employeeID objectAtIndex:z]];
            [userAttributes addObject:[NSString stringWithFormat:[myArrayOne objectAtIndex:17+y]]];
            [userAttributes addObject:[NSString stringWithFormat:[myArrayOne objectAtIndex:18+y]]];
            [userAttributes addObject:[NSString stringWithFormat:[myArrayOne objectAtIndex:22+y]]];
             y=y+17;
            //NSLog(@"%@",[userAttributes objectAtIndex:0]);
    }

where myArrayOne is a string array containing all the information. I am using employeeID array as key. How do I retrieve the information stored in the array for a particular key?? Thanks in advance.

Upvotes: 0

Views: 154

Answers (1)

Abizern
Abizern

Reputation: 150605

If you want to retrieve information based on a key, you store it in a dictionary rather than an array in the first place.

Upvotes: 1

Related Questions