NSDictionary to NSArray?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i have a NSDictionary which looks like: { "Item1" = 2.4; "Item2" = 5.5; "Item3" = 15.6; } To use this NSDictionary Items in a Table View i have to transfer it to a NSArray , am i right? So i try: NSDictionary *dict = [myDict objectForKey:@"items"]; for (id item in dict) { [_myArray addObject:[dict objectForKey:item]]; } But _myArray keeps empty? What am i doing wrong? 回答1: Leaving aside the technical issues with the code you posted, you asked this: To use this Dictionary Items in a Table View i have to transfer it to a NSArray, am i right?