ios - Add Object to an NSMutableArray that is an element of an NSDictionary -


in code below, declare nsdictionary , fill empty nsmutablearrays designated numeric keys:

nsdictionary *result = [[nsdictionary alloc] init]; for(float = 0; < 120; += 0.25){     [result setvalue:[[nsmutablearray alloc] init] forkey:[nsstring stringwithformat:@"%.2f", i]]; } 

now if have object want add 1 of arrays , key of array want add (for example if want add string array key 4.25), how add object array?

[result[@"4.25"] addobject: @"astring"]; 

note code won't work written. need create dictionary mutable if going add key/value pairs after it's created.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -