Search code examples
uitableviewediting

Weird Animation when inserting a row in UITableView


I have tableview which holds a list of data, when users press "Edit"

i add an extra row at the bottom saying "add new"

- (void)setEditing:(BOOL)editing animated:(BOOL)animated
{
    [super setEditing:editing animated:animated];

    NSArray *paths = [NSArray arrayWithObject:
                        [NSIndexPath indexPathForRow:1 inSection:0]];
    if (editing)
    {
        [[self tableView] insertRowsAtIndexPaths:paths 
                                withRowAnimation:UITableViewRowAnimationTop];
    }
    else {
        [[self tableView] deleteRowsAtIndexPaths:paths 
                                withRowAnimation:UITableViewRowAnimationTop];
    }
}

and of course the UITableView transform with animation, but weird thing is the row before the row that i just added, has different animation than all others.

all rows perform "slides in" animation, but that 2nd last one did a "fade in" animation.

and i didnt set any animation on the 2nd last row (or any other row), and if i didnt add the new row in, the animation slides in as normal when i switch to editing mode.

somehow i cant find an answer, i check with contact app on my phone, it didnt have that weird animation as i have, when they adding a new row on editing mode.

Any help would be appreciated. Thanks


Solution

  • This is probably not the answer you are wishing for, but I have the same problem. However it only appears on the iPhone Simulator 3.1.3 or older, not on the 3.2 iPad Simulator. I guess it is save to assume that this animation glitch is a bug in the iPhone (SDK).