I have this object that contains references to other objects:
1)views
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 the destruction of its different properties?
are there special things to be done in each one of these types or I just set them all to nil?
note: I am using ARC.
thanks,
Nimrod
It depends on whether you use Automatic Reference Counting (ARC) or not.
Without ARC you have to override the dealloc method and release the objects you own.
With ARC you can just set your main object to nil
. ARC will take care of releasing the object and all of the other objects it owns.
As you are using ARC, You dont need to bother much about the releasing the objects, Unless there is some Retain Cycle.
You can send nil to your object as yourObject=nil;
that will make it nil and will be released later on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With