¡@

Home 

2014/10/15 ¤U¤È 10:05:06

iphone Programming Glossary: ckeys

how to do true deep copy for NSArray and NSDictionary with have nested arrays/dictionary?

http://stackoverflow.com/questions/5453481/how-to-do-true-deep-copy-for-nsarray-and-nsdictionary-with-have-nested-arrays-di

@end @implementation NSDictionary SPDeepCopy NSDictionary deepCopy unsigned int count self count id cObjects count id cKeys count NSEnumerator e self keyEnumerator unsigned int i 0 id thisKey while thisKey e nextObject nil id obj self objectForKey.. @selector deepCopy cObjects i obj deepCopy else cObjects i obj copy if thisKey respondsToSelector @selector deepCopy cKeys i thisKey deepCopy else cKeys i thisKey copy i NSDictionary ret NSDictionary dictionaryWithObjects cObjects forKeys cKeys.. obj deepCopy else cObjects i obj copy if thisKey respondsToSelector @selector deepCopy cKeys i thisKey deepCopy else cKeys i thisKey copy i NSDictionary ret NSDictionary dictionaryWithObjects cObjects forKeys cKeys count count retain The newly..