CAAnimation not triggering - animationDidStop:

Discussion in 'iOS Programming' started by IDMah, Jan 3, 2012.

  1. macrumors regular

    Joined:
    May 13, 2011
    #1
    Roy Rogers horseless - No Trigger.

    Ok I think I'm at my wits end.. so Help Pleasseeeee !!!

    I have two animation using that I want to happen one after the other.

    I've been trying to get:

    Code:
    [scaleAnim setDelegate:self];	
    	
    Code:
    - (void)animationDidStop:(CABasicAnimation *)theAnimation finished:(BOOL)flag;
    {
    	//sorryAnimating = NO;
    	NSLog(@"************ animation finished ****************");
    }
    
    but nothing gets triggered..
    is there an easier way to do this I just want to fadout, change the (Buttons) /pieces then fade them in/back

    tried a delay ala:

    Code:
    [self performSelector:@selector(doNothing) withObject:nil afterDelay:2.0];
    	
    but doesn't seem to do anything ...

    what is the best way to do this sort of thing??

    thanks again.

    Ian
     
  2. macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #2
    Tried using UIView animationblocks?
    They have a BOOL completed (only will do what you want if you do actual UIView transformations, so 'removing from view', won't work etc.
    But fading out, something like this

    Code:
    
    [UIView animateWithDuration:0.4 animations:^{
                self.navigationController.view.alpha = 0.0;
            } completion:^(BOOL finished){
                [UIView animateWithDuration:ANIMATION_DURATION animations:^{
                    view.alpha = 1.0;
                }];
    
     
  3. thread starter macrumors regular

    Joined:
    May 13, 2011
    #3
    Lazy solution.

    thanks.

    my code is a mess. and I'm feeling lazy.. so I did this:

    Code:
    [self performSelector:@selector(refreshLabels) withObject:nil afterDelay:2.0]; 
    
    // Delay 2 second till animation is done..  
    
    [self performSelector:@selector(stupidAnimIn) withObject:nil afterDelay:2.0];
    
    [self performSelector:@selector(buttonRefreshAll) withObject:nil afterDelay:2.0];
    instead. Your solution I'm sure is better. but as I said code mess and
    lazy..

    thanks
    Ian

    ps. Weirdly the Start/Stop Animation delegate is working now.. that I don't need it.. eesh!
     

Share This Page