PDA

View Full Version : CAAnimation not triggering - animationDidStop:




IDMah
Jan 3, 2012, 02:25 AM
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:

[scaleAnim setDelegate:self];


- (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:

[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



jnoxx
Jan 3, 2012, 02:49 AM
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



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

IDMah
Jan 3, 2012, 01:29 PM
thanks.

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

[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!