tags:

views:

84

answers:

1

Hi, here's the scenario, I have this array of Person objects. copyWithZone is implemented on Person and works as expected.

I have an array of Person objects, however when I create a copy of the array and modify things in original array (change attributes of a Person) it changes the copy as well. So my best guess is that when I call copyWithZone on NSArray, it does not call it on its elements. Please confirm.

+1  A: 

Confirmed. Cocoa's collection classes implement NSCopying by creating a shallow copy. If you need a deep copy, you will have to implement it yourself.

Ole Begemann
ah, that explains it. thanks Ole.
malik