I have a simple UITableView
, when users adds new rows, these will be added to the NSMutableDictionary
. I can retrieve the values for a specific key.
NSArray *myArr = [myDictionary valueForKey:@"Food"];
This will show me all values for key food, this is an example of my NSLog:
( burger, pasta )
If I add more objects to myDictionary but for a different key, for example:
NSArray *drinks = [NSArray arrayWithObjects:@"cola",@"sprite",nil];
[myDictionary setObject:drinks forKey:@"Drink"];
I can't retrieve all values using the following code:
NSArray *allMenu = [myDictionary allValues];
It shows me the following NSLog:
( ( burger, past ), ( cola, sprite ) )
I don't know where is the problem. Why I can't get all values from NSDictionary
to NSArray
.
If I use the code:
NSArray *allMenu = [[myDictionary allValues] objectAtIndex:0];
will show me the Food values. If I change objectAtIndex to 1 will show me the Drink value.