From 957a14e1afb250e0a64f6224eb30abbaed31bad3 Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Fri, 22 Feb 2019 17:14:21 +0100 Subject: [PATCH] fix delete messages --- Classes/ChatConversationTableView.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Classes/ChatConversationTableView.m b/Classes/ChatConversationTableView.m index 4de6666e5..a981f3b13 100644 --- a/Classes/ChatConversationTableView.m +++ b/Classes/ChatConversationTableView.m @@ -318,9 +318,9 @@ static const CGFloat MESSAGE_SPACING_PERCENTAGE = 1.f; LinphoneEventLog *event = [[eventList objectAtIndex:indexPath.row] pointerValue]; linphone_event_log_delete_from_database(event); [eventList removeObjectAtIndex:indexPath.row]; - NSInteger index = indexPath.row + _currentIndex; + NSInteger index = indexPath.row + _currentIndex + (totalEventList.count - eventList.count); if (index < totalEventList.count) - [totalEventList removeObject:[NSNumber numberWithInteger:index]]; + [totalEventList removeObjectAtIndex:index]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationBottom]; @@ -366,9 +366,9 @@ static const CGFloat MESSAGE_SPACING_PERCENTAGE = 1.f; LinphoneEventLog *event = [[eventList objectAtIndex:indexPath.row] pointerValue]; linphone_event_log_delete_from_database(event); [eventList removeObjectAtIndex:indexPath.row]; - NSInteger index = indexPath.row + _currentIndex; + NSInteger index = indexPath.row + _currentIndex + (totalEventList.count - eventList.count); if (index < totalEventList.count) - [totalEventList removeObject:[NSNumber numberWithInteger:index]]; + [totalEventList removeObjectAtIndex:index]; }]; }