I have many viewControllers.
and all of them have many retained properties.
so, I would add these code to every viewControllers:
- (void)viewDidUnload {
self.every_retained_property = nil;
[super viewDidUnload];
}
- (void)dealloc {
[every_retained_property release];
[super dealloc];
}
Till now things all go well in my app.
But I heard that,
a_retained_property = newValue;
// equals to
[a_retained_property release];
a_retained_property = [newValue retain];
so if I've already set a_retained_property to nil in viewDidUnload,
it is neccessary to release a_retained_property in dealloc, like what I am doing?
I just wonder it.
Thanks!
It will not do you any harm, put it that way. But
a_retained_property = newValue;
is not equivalent to:
[a_retained_property release];
a_retained_property = [newValue retain];
Instead you should use:
self.a_retained_property = newValue;