I’m animating an NSScrollView scrolling, with this piece of code:
[NSAnimationContext beginGrouping];
NSClipView* clipView = [self contentView];
NSPoint newOrigin = [clipView bounds].origin;
newOrigin.x = page*kGalleryWidth;
[[clipView animator] setBoundsOrigin:newOrigin];
[NSAnimationContext endGrouping];
Now I’m trying to get the event that triggers the end of the animation.
I’ve read that with a some lines of code, using CAAnimation, I would easily achieve it, but I can’t.
I’ve tried these following code:
CAAnimation *moveAnimation = [[self.contentView animationForKey:@"frameOrigin"] copy];
moveAnimation.delegate = self;
[self.contentView setAnimations:[NSDictionary dictionaryWithObject:moveAnimation forKey:@"frameOrigin"]];
-
(void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{
NSLog(@”STOP!”);
}
Does someone can help me?
Thanks!
You can use this function: