Desired action: 
1) An NSBox (dstBox) with View A in it's content animates out to the left
2) NSBox's content is replaced with View B
3) NSBox with View B in it's content animates in from the right. 

Actual action:
1) An NSBox (dstBox) with View A in it's content animates out to the left
2) NSBox with View A in it's content animates in from the right. 
3) NSBox's content is replaced with View B

2 and 3 are swapped which is the problem.

The motion of the animation works fine.   The problem is the NSBox's content  
(dstBox) doesn't change on the screen until the animation is stopped.  I'd like 
it to be switched somewhere off screen so view B comes in from the right and 
the user doesn't see the switch happen.

Does someone have any suggestions I can try out?

Thanks



    //Move out
    [settings setObject:dstBox forKey:NSViewAnimationTargetKey];
    [settings setObject:[NSValue valueWithRect:startingFrame] 
forKey:NSViewAnimationStartFrameKey];
    if (toRight) {
        destFrame.origin.x += destFrame.size.width+1;
    } else {
        destFrame.origin.x -= destFrame.size.width-1;
    }
    [settings setObject:[NSValue valueWithRect:destFrame] 
forKey:NSViewAnimationEndFrameKey];
    // Animate
    NSAnimation *theAnim = [[NSViewAnimation alloc] 
initWithViewAnimations:[NSArray arrayWithObject:settings]];
    [theAnim setDuration:animationDuration];
    [theAnim setAnimationBlockingMode:NSAnimationBlocking];
    [theAnim startAnimation];

    

    
    // Update the View
    [dstBox setContentView:newView];
    
    
    
    
    // Move in
    if (toRight) {
        destFrame.origin.x -= (destFrame.size.width-1)*2;
    } else {
        destFrame.origin.x += (destFrame.size.width+1)*2;
    }
    [settings setObject:[NSValue valueWithRect:destFrame] 
forKey:NSViewAnimationStartFrameKey];
    [settings setObject:[NSValue valueWithRect:startingFrame] 
forKey:NSViewAnimationEndFrameKey];
    // Animate
    theAnim = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray 
arrayWithObject:settings]];
    [theAnim setDuration:animationDuration];
    [theAnim setAnimationBlockingMode:NSAnimationBlocking];
    [theAnim startAnimation];  
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to