forked from mirrors/linphone-iphone
set UiContactCell contact to null when leaving the view to avoid memory leak
This commit is contained in:
parent
333a9eed63
commit
f27f1de1ee
4 changed files with 12 additions and 0 deletions
|
|
@ -30,5 +30,6 @@
|
|||
}
|
||||
- (void)loadData;
|
||||
- (void)loadSearchedData;
|
||||
- (void)removeAllContacts;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -67,6 +67,15 @@
|
|||
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[self removeAllContacts];
|
||||
}
|
||||
|
||||
- (void)removeAllContacts {
|
||||
for (NSInteger j = 0; j < [self.tableView numberOfSections]; ++j) {
|
||||
for (NSInteger i = 0; i < [self.tableView numberOfRowsInSection:j]; ++i) {
|
||||
[[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:j]] setContact:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
- (void) viewWillDisappear:(BOOL)animated {
|
||||
self.view = NULL;
|
||||
[self.tableController removeAllContacts];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@
|
|||
}
|
||||
|
||||
- (void)dealloc {
|
||||
self.contact = NULL;
|
||||
[NSNotificationCenter.defaultCenter removeObserver:self];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue