我提到了DOC,它说:
completion
但是我发现不管你是否使用bool参数,completion:
块总是在animations:
块之后执行.就像下面显示的两个简单的基于块的动画代码片段一样,它们都在做相同的事情.
[UIView animateWithDuration:0.3f
delay:0.0f
options:UIViewAnimationCurveEaseInOut
animations:^{
[myView setAlpha:0.0f];
}
completion:^(BOOL finished) {
[myView removeFromSuperview];
}];
和
[UIView animateWithDuration:0.3f
delay:0.0f
options:UIViewAnimationCurveEaseInOut
animations:^{
[myView setAlpha:0.0f];
}
completion:^(BOOL finished) {
if (finished) [myView removeFromSuperview];
}];
我发现大多数人(包括我)都使用第一个(甚至是苹果官方的doc示例).所以
- 这里的
finished
参数到底是用来做什么的? - 或者将使用什么情况?