Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoa setAnimationDidStopSelector

Currently I have this code that works fine

[UIView setAnimationDidStopSelector:@selector(animationDone:finished:context:)];

- (void)animationDone:(NSString *)animationID finished:(BOOL)finished context:(void *)context {
// do stuff here
}

Logging the value of animationID gives me a null.

How can I pass value to the @selector?

I tried

[UIView setAnimationDidStopSelector:@selector(animationDone:@"animation1"finished:context:)];

That gives me an error.

Thanks, Tee

like image 279
teepusink Avatar asked Jan 04 '10 13:01

teepusink


1 Answers

The string passed to the selector is the one you use in this method call:

[UIView beginAnimations:@"your_animation_name_here" context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
// whatever changes here
[UIView commitAnimations];

Afterwards, you can do this:

- (void)animationFinished:(NSString *)animationID finished:(BOOL)finished context:(void *)context
{
    if ([animationID isEqualToString:@"your_animation_name_here"])
    {
        // something done after the animation
    }
}
like image 94
Adrian Kosmaczewski Avatar answered Sep 18 '22 15:09

Adrian Kosmaczewski