4
我有一个简单的转换动画,将UITableViewCell 70像素向左移动。在if
部分,动画效果很好,并且我得到了平滑过渡。但是,当再次调用函数以将单元放回其原始位置(即else
部分)时,我不会获得动画。它只是恢复正常,但没有动画。我怎样才能解决这个问题?UIView动画CGAffineTransformMake不工作
if([[slideArray objectAtIndex:indexPath.row] intValue]==0)
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.4];
selectedCell.transform=CGAffineTransformMakeTranslation(-70, 0);
[UIView commitAnimations];
[slideArray replaceObjectAtIndex:indexPath.row withObject:[NSNumber numberWithInt:1]];
}
else
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.4];
selectedCell.transform=CGAffineTransformMakeTranslation(0, 0);
[UIView commitAnimations];
[slideArray replaceObjectAtIndex:indexPath.row withObject:[NSNumber numberWithInt:0]];
}
不确定它会帮助你解决问题,但指定第二个转换的正常方法是CGAffineTransformIdentity。 – morningstar
这并没有解决我的问题 – Snowman