That depends on how deep you want the copy of the array to be. If one level is enough, - initWithArray:copyItems:
is going to do the trick. If you want an actual deep copy, you have to write it yourself I'm afraid.
How to copy all objects of NSArray when copying the array itself [duplicate]
-
06-08-2022 - |
Pergunta
I have an array of objects
I want to copy the array and all contents of it
"Object" implements NSCopying
I thought that doing
NSArray *copiedArray = [array copy];
would trigger copyWithZone in the objects contained inside of it.
Unfortunally not...
How can this be done?
Solução
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow