¡@

Home 

2014/10/15 ¤U¤È 10:04:54

iphone Programming Glossary: carray

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

on 3 15 09. #import SPDeepCopy.h @implementation NSArray SPDeepCopy NSArray deepCopy unsigned int count self count id cArray count for unsigned int i 0 i count i id obj self objectAtIndex i if obj respondsToSelector @selector deepCopy cArray i.. cArray count for unsigned int i 0 i count i id obj self objectAtIndex i if obj respondsToSelector @selector deepCopy cArray i obj deepCopy else cArray i obj copy NSArray ret NSArray arrayWithObjects cArray count count retain The newly created array.. int i 0 i count i id obj self objectAtIndex i if obj respondsToSelector @selector deepCopy cArray i obj deepCopy else cArray i obj copy NSArray ret NSArray arrayWithObjects cArray count count retain The newly created array retained these so now..