【发布时间】:2014-01-10 04:50:51
【问题描述】:
目标:
在单个 UIView 上同时播放多个动画。
问题:
据我所知,这是不可能的。每个动画必须按顺序出现,不能重叠。
本质上,我想要一个 UIView 垂直动画,同时水平动画。由于我使用的是 UIViewAnimationOptionRepeat,因此我无法在 onCompletion 中嵌套任何其他动画:这是我想要工作但没有做到的:
[UIView animateWithDuration:duration
delay:kANIMATION_DELAY
options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse animations:^{
object.frame = CGRectMake(object.frame.origin.x + 40,
object.frame.origin.y,
object.frame.size.width,
object.frame.size.height);
[UIView animateWithDuration:duration
delay:kANIMATION_DELAY
options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse animations:^{
object.frame = CGRectMake(object.frame.origin.x,
object.frame.origin.y - 40,
object.frame.size.width,
object.frame.size.height);
} completion:^(BOOL finished) {
}];
} completion:^(BOOL finished) {
}];
【问题讨论】:
标签: ios objective-c uiviewanimation