iphone - NSDictionary to NSArray containing keys and values -
i don't know if there easy way implement this, or need implemente algorithm myself.
this have (nsdictionary):
{ 14 = ( "m" ); 15 = ( "h" ); 16 = ( "f", "g" ); and want (nsarray):
{ 14, "m", 15, "h" ... } im looking easy way, in case need algorithm i'll myself
you iterate on nsdictionaryand add keys , values this:
nsmutablearray *array = [nsmutablearray array]; [may enumeratekeysandobjectsusingblock:^(id key, id obj, bool *stop) { [array addobject:key]; (int = 0; < [obj count]; i++){ [array addobject:[obj objectatindex:i]]; } }];
Comments
Post a Comment