diff --git a/Classes/ContactsListTableView.h b/Classes/ContactsListTableView.h index 591c137e4..af5e6ab1b 100644 --- a/Classes/ContactsListTableView.h +++ b/Classes/ContactsListTableView.h @@ -30,5 +30,6 @@ } - (void)loadData; - (void)loadSearchedData; +- (void)removeAllContacts; @end diff --git a/Classes/ContactsListTableView.m b/Classes/ContactsListTableView.m index 9ea61f4f4..a9fc89ef5 100644 --- a/Classes/ContactsListTableView.m +++ b/Classes/ContactsListTableView.m @@ -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 - diff --git a/Classes/ContactsListView.m b/Classes/ContactsListView.m index 15d5398d5..82d6e7117 100644 --- a/Classes/ContactsListView.m +++ b/Classes/ContactsListView.m @@ -150,6 +150,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void) viewWillDisappear:(BOOL)animated { self.view = NULL; + [self.tableController removeAllContacts]; } #pragma mark - diff --git a/Classes/LinphoneUI/UIContactCell.m b/Classes/LinphoneUI/UIContactCell.m index 0b74e267b..35bbb584a 100644 --- a/Classes/LinphoneUI/UIContactCell.m +++ b/Classes/LinphoneUI/UIContactCell.m @@ -53,6 +53,7 @@ } - (void)dealloc { + self.contact = NULL; [NSNotificationCenter.defaultCenter removeObserver:self]; }