[self.tableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:row inSection:0]]
withRowAnimation:UITableViewRowAnimationNone];
When doing this every row after the one I'm inserting slides down. I want them to immediately jump to their new place. I don't want to call reloadData
since then all my cells would be redrawn.
Is it possible to remove this animation?
This works for me:
[UIView setAnimationsEnabled:NO];
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:indexPath
withRowAnimation:UITableViewRowAnimationNone];
[self.tableView endUpdates];
[UIView setAnimationsEnabled:YES];
Hope this helps.
This also works
[UIView performWithoutAnimation:^{
[self.tableView insertRowsAtIndexPaths:indexPaths:withRowAnimation:UITableViewRowAnimationNone];
});
Swift example (from my chat)
UIView.performWithoutAnimation {
messagesTable.insertRows(at: [IndexPath(row: messages.count - 1, section: 0)], with: .none)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With