gpt4 book ai didi

iphone - 如何将 NSMutableDictionary 值复制到 iPhone 中的另一个 NSMutableDictionary 中?

转载 作者:行者123 更新时间:2023-12-03 19:02:59 25 4
gpt4 key购买 nike

我想将 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com