我很困惑,为什么这不起作用。我将这三个事件一个接一个地发生。第一个放大和图像出,第二个在背景中淡出,第三个动画显示第一个图像。但它实际上是相反的发生?我做了些傻事吗?UIView animateKeyFramesWithDuration不在正确的时间开始
[UIView animateKeyframesWithDuration:2.0 delay:0.0 options:UIViewKeyframeAnimationOptionBeginFromCurrentState animations:^{
[UIView addKeyframeWithRelativeStartTime:0.0 relativeDuration:0.25 animations:^{
[v setFrame:CGRectMake(self.view.center.x - 125, self.view.center.y - 125, 250, 250)];
}];
[UIView addKeyframeWithRelativeStartTime:0.50 relativeDuration:0.75 animations:^{
[UIView transitionWithView:self.fullView
duration:0
options:UIViewAnimationOptionTransitionCrossDissolve
animations:NULL
completion:NULL];
[self.fullView setHidden:NO];
}];
[UIView addKeyframeWithRelativeStartTime:1.50 relativeDuration:0.5 animations:^{
v.animationImages = [self.imageDict objectForKey:id];
v.animationRepeatCount = 1;
[v startAnimating];
}];
}
completion:nil];
EDIT // 除了错字(1.50 addKeyFrameWithRelativeStartTime
),第三块中不工作,因为该方法UIImageView startAnimating
需要放置在完成块。
糟糕的1.5是一个错字 - 我现在已经把它改为0.5。来自文档的片段非常有用 - 我现在就玩这个游戏。 –