Since we can’t rely on calling viewDidUnload before dealloc, I found myself having a lot of duplicate code between methods.
- (void)viewDidUnload {
[super viewDidUnload];
self.foo = nil;
self.bar = nil;
}
- (void)dealloc {
[super dealloc];
[foo release];< br /> [bar release];
[abc release];
}
Redundant code, ick. Does anyone know of more problems with this?
- (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 extra call [super viewDidUnload], but I think this is a non-issue because it just did what it should Things done in dealloc. I also switched viewDidUnload, so it didn’t use the accessor.
I am not going to enter when and why which one should be called. (There are already many)
Because of us Can’t rely on calling viewDidUnload before dealloc, I found myself having a lot of duplicate code between methods.
- (void)viewDidUnload {
[super viewDidUnload] ;
self.foo = nil;
self.bar = nil;
}
- (void)dealloc {
[super dealloc]; < br /> [foo release];
[bar release];
[abc release];
}
Redundant code, ick. Does anyone know of more problems with this?
- (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 extra call [super viewDidUnload], but I think this is a non-issue because it just did what it should Things done in dealloc. I also switched viewDidUnload, so it didn’t use accessors.
I decomposed deallocs and nil sets into -releaseOutlets methods. ( I put more than released outlets here, which is just historical to me.) Then call the method from each. Do not call viewDidUnload from dealloc, this is undefined behavior and may change at any time.