Animated view swapping?


#1

I’d like to add some (Core) Animation to the swapping, eg slide in/out. Any ideas how to accomplish this?


#2

I won’t tell the whole story, but I will provide some hints:

    ...
    NSDictionary *animation1 = [NSDictionary dictionaryWithObjectsAndKeys:view1, NSViewAnimationTargetKey, NSViewAnimationFadeInEffect, NSViewAnimationEffectKey, nil];
    
    NSDictionary *animation2 = [NSDictionary dictionaryWithObjectsAndKeys:view2, NSViewAnimationTargetKey, NSViewAnimationFadeOutEffect, NSViewAnimationEffectKey, nil];

    NSAnimation *animation = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObjects:animation1, animation2, nil]];

    animation.duration = 2.0;
    [animation startAnimation];
    [animation release];
    ...

#3

Got it, thanks!