I have a NSDictonary object that I am setting a set of objects as an array that has a corresponding key to as follows.
[dictionary setObject: [NSArray arrayWithObjects:@"Player3_Title", @"FirstName", @"LastName", @"Address3", @"SS3", nil] forKey: @"player3_infoKey"];
What I want to do is get those objects back into an array. When I try the following code this is what I get as an output.
stringsMutableArray = [[NSMutableArray alloc] initWithObjects:nil];
[stringsMutableArray addObject:[dictionary objectForKey:@"player3_infoKey"]];
NSLog(@"stringsMutableArray has values: %d", [stringsMutableArray count]);
NSLog(@"stringMutableArray: %@", [stringsMutableArray objectAtIndex:0]);
OUTPUT:
2012-01-01 08:50:29.869 test project[1165:f803] stringsMutableArray has values: 1
2012-01-01 08:50:29.870 test project[1165:f803] stringMutableArray: (
"Player3_Title",
FirstName,
LastName,
Address3,
SS3
)
Is there a way I can get the values for that key into an array? The reason I want to do this is that somewhere in the code I want to set text button values from that array.
FirstNameField1.text = [stringsMutableArray objectAtIndex:1];
LastNameField1.text = [stringsMutableArray objectAtIndex:2];
I think you simply want to :
If you don’t need it to be mutable: