What's the correct way to destroy various objects in the c lens?
I have this object that contains references to other objects:
1) considers
2) view controllers
3) dictionaries
4) arrays
5) custom objects.
what's the best way to destroy it? do I need to create a destroy method that will deal with destroying its various properties?
are there any special things to do in each of these types, or did I just set them all to zero?
Note. I am using ARC.
thanks
nimrod
+3
source to share
2 answers
It depends on whether you are using Automatic Reference Counting (ARC) or not.
Without ARC, you must override the dealloc method and release the objects you own.
With ARC, you can simply set your main object to nil
. ARC will take care of freeing the object and all its other objects.
+6
source to share