Reputation: 8613
I am trying to figure out how to set a call back for when my nsview animator stops. Anyone know how to do this.
NSRect frame = blob.frame;
frame.origin.x = animationStopX;
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:timeToDisappear];
[[blob animator] setFrame:frame];
[NSAnimationContext endGrouping];
Upvotes: 1
Views: 506
Reputation: 6098
On 10.8, NSAnimationContext
has completionHandler
property which you can use with a block.
Upvotes: 2
Reputation: 3854
You can set delegate for frameOrigin animation.
CAAnimation *moveAnimation = [[blob animationForKey:@"frameOrigin"] copy];
moveAnimation.delegate = self;
[blob setAnimations:[NSDictionary dictionaryWithObject:moveAnimation forKey:@"frameOrigin"]];
[moveAnimation release];
And override end animation delegate method
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
Upvotes: 0