I want to copy a NSMUtableDictionary values into the another NSMutableDictioary. How can i do that?
Here my code is,
PersonClass.h file:
NSMutableDictionary *tempDictionary;
@property (nonatomic, retain) NSMutableDictionary *tempDictionary;
PersonClass.m
@synthesize tempDictionary;
tempDictionary = [[NSMutableDictionary alloc] init];
-(PersonClass *) initWithPerson:(NSMutableDictionary *) feedDictionary
{
// get all the values in feedDictionary.
//Now i want copy of the details from feedDictionary into the tempDictionary
tempDictionary = feedDictionary; // Doesn't copy.
}
I want to access the tempDictionary values to the person class. SO how can i copy from feedDictionary to the tempDictionary. Please help me out.
Thanks.
How about this?
tempDictionary = [[NSMutableDictionary alloc]initWithDictionary:feedDictionary];
Cheers
[feedDictionary mutableCopy];
This will copy all entries in the dictionary, but it will not copy custom objects unless you implement the NSCopying protocol.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With