UITableView estranho inserir / excluir animação de linha
Estou vendo um efeito estranho ao inserir / excluir um UITableViewCell em um UITableView com animação (UITableViewRowAnimationTop).
A falha de animação ocorre quando a célula a inserir é muito maior que a célula acima.
Esse vídeo mostra a falha no simulador, a célula amarela aparece de repente do nada quando deveria deslizar do topo.
Aqui é o projeto Xcode do vídeo.
Abaixo está o código de inserção / animação da célula.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 2 + self.thirdCellVisible;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:NO];
if (indexPath.row == 1)
{
if (self.thirdCellVisible)
{
self.thirdCellVisible = !self.thirdCellVisible;
[tableView deleteRowsAtIndexPaths:@[self.thirdCellIndexPath]
withRowAnimation:UITableViewRowAnimationTop];
}
else
{
self.thirdCellVisible = !self.thirdCellVisible;
[tableView insertRowsAtIndexPaths:@[self.thirdCellIndexPath]
withRowAnimation:UITableViewRowAnimationTop];
}
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == self.thirdCellIndexPath.row)
{
return 100.0f;
}
return 44.0f;
}