Reputation: 227
My question is simple but though I didn't found a precise answer on the net. Do I have to set to nil a strong property in viewDidUnload method ?
I know weak property will be automatically set to nil but what about strong property? Do I have to do this in viewDidUnload and also in didReceiveMemoryWarning ?
Thank you a lot! Teddy
Upvotes: 0
Views: 945
Reputation: 25740
You should set it to nil in the "companion" function to where it is set, or where you want it to go away. For instance, if you set it in viewDidLoad
you typically set it to nil in viewDidUnload
. If you set it in viewWillAppear
then set it to nil in viewWillDisappear
.
Set it to nil in didReceiveMemoryWarning
if it is something that you don't really need and can be recreated when you do need it next. (such as variables automatically created in their getter's).
Upvotes: 7