I will not go into what is called when and why. (There is already a lot of things)
Since we cannot rely on viewDidUnloadwhich is called before dealloc, I find myself with a lot of duplicated code between methods.
- (void)viewDidUnload {
[super viewDidUnload];
self.foo = nil;
self.bar = nil;
}
- (void)dealloc {
[super dealloc];
[foo release];
[bar release];
[abc release];
}
Backup Code, ick. Does anyone know the problem with this anymore?
- (void)viewDidUnload {
[super viewDidUnload];
[foo release];
foo = nil;
[bar release];
bar = nil;
}
- (void)dealloc {
[super dealloc];
[self viewDidUnload];
[abc release];
}
Of course, I have an additional challenge [super viewDidUnload], but I believe that this is not a problem, because it just does things that would be done deallocanyway. I also switched viewDidUnload, so he did not use accessors.
source
share