I'm trying to implement a nested animation block. The issue I'm facing is that only my completion block code is called. When I comment that out, the initial part is called. How do I get the animation to finish the first animation and then call the second one?
- (void)viewDidAppear:(BOOL)animated
{
_finalLogoCenter = self.logoImage.center;
// Logo Animation
[self logoAnimation];
}
- (void) logoAnimation
{
[UIView animateWithDuration:1.0
delay:0.0
options:UIViewAnimationOptionTransitionNone
animations:^ {
// Move Up
[self moveLogoUpFirst];
}completion:^(BOOL finished)
{
// Move below final point
[self moveLogoDownBeyondFinalPoint];
}];
}
- (void) moveLogoUpFirst
{
__block CGPoint logoCenter = self.logoImage.center;
logoCenter.y = 290.0f;
self.logoImage.center = logoCenter;
[self.logoImage setAlpha:0.0f];
[UIView animateWithDuration:1.0
delay:0.0
options:UIViewAnimationOptionTransitionNone
animations:^ {
logoCenter.y = _finalLogoCenter.y - 20;
self.logoImage.center = logoCenter;
[self.logoImage setAlpha:1.0f];
}completion:nil];
}
- (void) moveLogoDownBeyondFinalPoint
{
__block CGPoint logoCenter = self.logoImage.center;
self.logoImage.center = logoCenter;
[UIView animateWithDuration:1.0
delay:0.0
options:UIViewAnimationOptionTransitionNone
animations:^ {
logoCenter.y = _finalLogoCenter.y + 5;
self.logoImage.center = logoCenter;
}completion:nil];
}