将NSDictionary复制到NSArray

时间:2011-04-26 09:57:50

标签: objective-c ios nsarray nsdictionary

我有一个声明为NSDictionary的变量。如何将其复制到extern const NSArray变量?例如:

NSMutableDictionary *selectedItem = [self.dataArray objectAtIndex:indexPath.row];
[selectedItem setObject:[NSNumber numberWithBool:targetCustomCell.checked]     
                 forKey:@"checked"];

1 个答案:

答案 0 :(得分:15)

allKeys会返回包含所有密钥的NSArrayallValues会返回包含所有值的NSArray

NSArray *keys = [myDict allKeys];
NSArray *values = [myDict allValues];