iOS 11 UITableView delete rows animation bug iOS 11 UITableView delete rows animation bug ios ios

iOS 11 UITableView delete rows animation bug


I have been having countless problems with iOS 11 UITableView. Going to every UITableView in my entire app and doing the following fixed all of my problems.

Set estimatedRowHeight, estimatedSectionHeaderHeight, and estimatedSectionFooterHeight to 0.

Source: iOS 11 Floating TableView Header


In iOS 11.2, I had a bad animation after deleting a row using the standard row actions. I was only able to improve the situation by wrapping the row delete and row action dismissal in a CATransaction.

I dismiss the row actions first and wait for that animation to complete before deleting the row from the table view.

It at least doesn't jump around the table views content offset anymore, but is a lengthy two step animation. I'm still looking for a better solution.

        CATransaction.begin()        CATransaction.setCompletionBlock({            self.tableView.beginUpdates()            self.myViewModel?.items?.remove(at: indexPath.row)            self.tableView.deleteRows(at: [indexPath], with: UITableViewRowAnimation.top)            self.tableView.endUpdates()        })        self.tableView.setEditing(false, animated: true)        CATransaction.commit()


I had similar problem with table row removal animation on iOS 11 sometimes scrolling the table cells strangely (iOS 10 worked just fine). What helped was implementing this delegate method returning row height:

- (CGFloat) tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath

After that both iOS 10 and 11 work just fine.