Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing animation when calling setEditing:animated: to delete cells from table view

When deleting cells it calls my setEditing:animated: method which i have overridden because I need to adjust the height of my cells when editing, but because of this when I press the edit button the slide in animation of the red circles with the minus signs don't occur, instead they just appear into the cell. How Can I fix this?

This is my setEditing:animated code at the moment

- (void)setEditing:(BOOL)editing animated:(BOOL)animated{
[self.tableView setEditing:editing animated:YES];

[self.tableView reloadData];

[super setEditing:editing animated:animated];

}

Any help will be appreciated! Thanks

like image 611
Peter Avatar asked Feb 21 '11 23:02

Peter


1 Answers

There's a reload call just for this purpose. Try:

   - (void)setEditing:(BOOL)editing animated:(BOOL)animated{
        [self.tableView reloadRowsAtIndexPaths:[self.tableView indexPathsForVisibleRows] withRowAnimation:UITableViewRowAnimationMiddle];
        [super setEditing:editing animated:animated];
    }
like image 83
mackworth Avatar answered Oct 04 '22 07:10

mackworth