我想将一个 NSMUtableDictionary 值复制到另一个 NSMutableDictionary 中。我怎样才能做到这一点?
这是我的代码,
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.
}
我想访问 person 类的 tempDictionary 值。那么如何从 feedDictionary 复制到 tempDictionary。请帮帮我。
谢谢。
最佳答案
这个怎么样?
tempDictionary = [[NSMutableDictionary alloc]initWithDictionary:feedDictionary];
干杯
关于iphone - 如何将 NSMutableDictionary 值复制到 iPhone 中的另一个 NSMutableDictionary 中?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4827101/