Animated view swapping?


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


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];


Got it, thanks!