I\'m having some issues when deleting the last row of my (only) section in my tableView. Any other row works fine, but if I delete the row at the bottom of my <
My solution to this painful issue :)
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
[UIView animateWithDuration:0.25f
animations:^{
UIScrollView *internalScrollView = (UIScrollView*)cell.contentView.superview;
if([internalScrollView isKindOfClass:[UIScrollView class]]){
[internalScrollView setContentOffset:CGPointZero animated:YES];
}
cell.center = CGPointMake(cell.center.x - cell.bounds.size.width, cell.center.y);
} completion:^(BOOL finished) {
[self.rowModels removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft];
}];
}