diff --git a/Classes/HistoryListTableView.m b/Classes/HistoryListTableView.m index f99dc4e6a..d8755c2a1 100644 --- a/Classes/HistoryListTableView.m +++ b/Classes/HistoryListTableView.m @@ -123,12 +123,16 @@ logs = ms_list_next(logs); } + [self computeSections]; + + [super loadData]; +} + +- (void)computeSections { NSArray *unsortedDays = [self.sections allKeys]; self.sortedDays = [unsortedDays sortedArrayUsingComparator:^NSComparisonResult(NSDate *d1, NSDate *d2) { return ![d1 compare:d2]; // reverse order }]; - - [super loadData]; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { @@ -207,6 +211,9 @@ [[_sections objectForKey:_sortedDays[indexPath.section]] removeObject:log]; if (((NSArray *)[_sections objectForKey:_sortedDays[indexPath.section]]).count == 0) { [_sections removeObjectForKey:_sortedDays[indexPath.section]]; + [tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] + withRowAnimation:UITableViewRowAnimationFade]; + [self computeSections]; } [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] diff --git a/Classes/LinphoneUI/UICheckBoxTVTableViewController.m b/Classes/LinphoneUI/UICheckBoxTVTableViewController.m index 3fde52eb8..94983e1ad 100644 --- a/Classes/LinphoneUI/UICheckBoxTVTableViewController.m +++ b/Classes/LinphoneUI/UICheckBoxTVTableViewController.m @@ -75,6 +75,7 @@ cell.accessoryType = UITableViewCellAccessoryNone; } _deleteButton.enabled = (_selectedItems.count != 0); + _editButton.enabled = YES; } - (void)setEditing:(BOOL)editing animated:(BOOL)animated { @@ -101,12 +102,14 @@ [_selectedItems sortUsingComparator:^(NSIndexPath *obj1, NSIndexPath *obj2) { return [obj2 compare:obj1]; }]; - for (NSIndexPath *indexPath in _selectedItems) { + NSArray *copy = [[NSArray alloc] initWithArray:_selectedItems]; + for (NSIndexPath *indexPath in copy) { [self tableView:self.tableView commitEditingStyle:UITableViewCellEditingStyleDelete forRowAtIndexPath:indexPath]; } [_selectedItems removeAllObjects]; + [self setEditing:NO animated:YES]; } - (void)onSelectionToggle:(id)sender {