【发布时间】:2012-10-18 10:56:03
【问题描述】:
我有一个 NSDictionary,我必须将它添加到 NSArray。我该怎么做?
NSDictionary *row = [NSDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithFormat:@"%@",NSLocalizedString(@"no_favorites", nil)], @"Address", nil];
如果我使用:
aFavorite = [row allValues];
按照建议,如果我打印它,我得到了:
(
"No favorites added"
)
我需要的是:
(
{
Address = "No favorites added";
}
)
因为我会使用:
NSDictionary* dict = [aFavorite objectAtIndex:[indexPath row]];
NSString *contentForThisRow = [dict objectForKey:@"Address"];
dict 值可以有 1 或 2 个键。
【问题讨论】:
-
您的意思是要将 NSDictionary 转换为 NSArray?
-
是的,就是我要找的
标签: objective-c nsarray nsdictionary