• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Swap NSBox content without user seeing it when animation is involved
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Swap NSBox content without user seeing it when animation is involved


  • Subject: Swap NSBox content without user seeing it when animation is involved
  • From: Brad Stone <email@hidden>
  • Date: Mon, 01 Apr 2013 12:11:25 -0400

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@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Swap NSBox content without user seeing it when animation is involved
      • From: Fritz Anderson <email@hidden>
  • Next by Date: Re: Swap NSBox content without user seeing it when animation is involved
  • Next by thread: Re: Swap NSBox content without user seeing it when animation is involved
  • Index(es):
    • Date
    • Thread