I made a custom object that inherits from NSObject. Let’s say I have an array of these objects. Then I want to make another object, that is a copy of one of the objects in the array. I do not want to simply point to an existing object in the array I want a copy. Is there an easy way to do this?
Share
Implement the
NSCopyingprotocol on the object, and use it as follows:Note that
theCopyis a retained object at this point, and should be released when you are done with it.