Copying the contents of an NSMutableDictionary into another NSMutableDictionary?
问题 I have an NSMutableDictionary each element of which is another dictionary. What is the best way I can copy its contents into another NSMutableDictionary ? I've tried using: firstDictionary = [NSMutableDictionary dictionaryWithDictionary:secondDictionary]; However not sure if this is the best way to do it. 回答1: Check the NSDictionary initWithDictionary:copyItems: method. It it enables deep copying of elements thru calling copyWithZone: method of item's class. You will have to take care of