Skip to content

Commit

Permalink
Delete cell only if deletion method succeeded
Browse files Browse the repository at this point in the history
  • Loading branch information
ghazi_denden committed Oct 18, 2016
1 parent 097f2f7 commit 1749aa6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions SDTableView.podspec
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Pod::Spec.new do |s|
s.name = "SDTableView"
s.version = "1.0.4"
s.version = "1.0.5"
s.summary = "SDTableView is a simple UITableView Framework for quick and advanced development"
s.license = "license"
s.authors = '[email protected]'
s.homepage = 'http://www.google.fr'
s.source = { :git => "[email protected]:agodet/SDTableView.git", :tag => "1.0.4" }
s.source = { :git => "[email protected]:agodet/SDTableView.git", :tag => "1.0.5" }
s.platform = :ios, '7.0'
s.public_header_files = 'SDTableView/*.h'
s.source_files = 'SDTableView/*.{h,m}'
Expand Down
11 changes: 8 additions & 3 deletions SDTableView/SDTableViewHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,15 @@ -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEdi
[self.sectionsArray removeObjectAtIndex:indexPath.section];
}

[tableView beginUpdates];
[self reloadDefinitions];
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
[tableView endUpdates];

if ([((SDSectionDefinition *)[self.sectionsArray objectAtIndex:indexPath.section]).cells count] < [section.cells count]){
[tableView beginUpdates];
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
[tableView endUpdates];
}else{
[tableView reloadData];
}

#pragma clang diagnostic pop
}
Expand Down

0 comments on commit 1749aa6

Please sign in to comment.