Purpose :
At the same time, several animations are played on one UIView.
Problem :
From what I can say, this is impossible. Each animation must be performed sequentially and cannot overlap.
In essence, I want one UIView to animate vertically while animating horizontally. Since I'm using UIViewAnimationOptionRepeat , I can not insert any other animation in onCompletion: . Here I want to work, but not:
[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) {
}];
source
share