开发者

How to make a deep copy of an NSDictionary, the easy way?

开发者 https://www.devze.com 2023-01-07 10:45 出处:网络
How to开发者_StackOverflow社区 make a deep copy of an NSDictionary, the easy way? In particular, it\'s an NSUserDefaults dictionary that contains only property list objects, so objects which are seria

How to开发者_StackOverflow社区 make a deep copy of an NSDictionary, the easy way? In particular, it's an NSUserDefaults dictionary that contains only property list objects, so objects which are serializable.

Would I just iterate over it and build a complete new one with copied values? Guess you guys have a better solution.


You could use

newDict = [[NSDictionary alloc] initWithDictionary:oldDict copyItems:YES];
0

精彩评论

暂无评论...
验证码 换一张
取 消