0

I try to use animationWithDuration and transitionWithView to create one big animation. I want to do something like this :

  1. Move view A with animationWithDuration
  2. After step1 is completed, move view B with animationWithDuration
  3. After step2 is completed, show view C with transitionWithView (With OptionCurlDown)

I really look over the net, and i don't know how to correclty do that. My problem is that the step 3 start always at the same time as step A. If i do only step 1 and step 2, this is ok, i mean, step 2 starts only when step 1 is done. But i had no luck with step 3!

I also tried to nest transitionWithView inside an animationWithDuration, but the result is the same,

THank you

Update

The following is the code itself :

Main function:

    [fileMenuController hide:0.2 andDelay:0.1]; 
    [drawingToolController show:0.2 andDelay:0.2];
    [penSizeMenuController showSubViewWithDuration:0.4];

fileMenuController hide function:

 [UIView animateWithDuration:duration //begin animation
                      delay:delay 
                    options:UIViewAnimationCurveEaseIn 
                 animations:^{
                     [self.view setFrame:CGRectOffset([self.view frame], 0, -self.view.frame.size.height)];             
                 } 
                 completion:nil
 ];

drawingToolController show function:

[UIView animateWithDuration:duration //begin animation
                      delay:delay
                    options:UIViewAnimationCurveEaseIn 
                 animations:^{
                     [self.view setFrame:CGRectOffset([self.view frame], 0, self.view.frame.size.height)];             
                 } 
                 completion:nil
 ];

penSizeController show function:

[UIView transitionWithView:self.view 
              duration:duration
               options:UIViewAnimationOptionTransitionCurlDown
            animations:^{ [self.view addSubview:subView] ;}
            completion:nil];

self.view.alpha = 1;

penSizeController show always starts at the same time as fileMenuController hide

Update to resolve the problem

Following the idea of user523234 , i did that :

MainFunction

    [fileMenuController hide:0.2 andDelay:0.1]; 
    [drawingToolController show:0.2 andDelay:0.2];
    [self performSelector:@selector(delayedPenSizeMenuShow)withObject:nil afterDelay:0.4)

MainFunction (newFunction)

    -(void) delayedPenSizeMenuShow{
        [penSizeMenuController showSubViewWithDuration:0.4];
    }

This way, it works, penSizeMenuController is called after the 2 animations. But i am wondering is it is ok with the new block base philosophy with ios 4.0?

But well, at least i have somethin..

peterphonic
  • 1,013
  • 1
  • 16
  • 34

0 Answers0