Iphone 动画完成立即调用
我有以下动画块:Iphone 动画完成立即调用,iphone,ipad,objective-c-blocks,uiviewanimation,Iphone,Ipad,Objective C Blocks,Uiviewanimation,我有以下动画块: [UIView animateWithDuration:2 animations:^{ [childViewController_.view setAlpha:0]; } completion:^(BOOL finished) { [childViewController_.view
[UIView animateWithDuration:2
animations:^{
[childViewController_.view setAlpha:0];
}
completion:^(BOOL finished) {
[childViewController_.view removeFromSuperview];
}];
当按上述方式执行时,立即调用完成块。
但是,如果我没有完成块,则动画将按预期执行
我做错了什么
更新完成块中的
finished
标志是NO
您刚刚忘记检查一个条件
[UIView animateWithDuration:2
animations:^{
[childViewController_.view setAlpha:0];
}
completion:^(BOOL finished) {
if (finished)
{
[childViewController_.view removeFromSuperview];
}
}];
函数接收的完成参数是什么?其他东西可能会中断动画吗?你是对的-它返回否。我如何知道原因?我也有同样的问题,你最终找到了解决方案吗?如果动画被中断,将返回否。是否可能释放视图?