Re: Swap NSBox content without user seeing it when animation is involved
Re: Swap NSBox content without user seeing it when animation is involved
- Subject: Re: Swap NSBox content without user seeing it when animation is involved
- From: Brad Stone <email@hidden>
- Date: Mon, 01 Apr 2013 15:09:14 -0400
I was using an NSBox for my convenience to make view swapping easy. The super view has two boxes (dstBox is one of them) and there are three different views that get swapped into and out of the bottom box. Using an NSBox makes this pretty easy. That's why it's designed that way.
On Apr 1, 2013, at 1:30 PM, Fritz Anderson <email@hidden> wrote:
> On 1 Apr 2013, at 11:11 AM, Brad Stone <email@hidden> wrote:
>
>> 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?
>
> It is possible that during a single animation, a view's contents are reduced to an OpenGL texture, and won't update until the animation completes. Or this is an effect of the animationBlockingMode you've chosen.
>
> You have two completely different instances of visible content. There's no reason to be stingy. Use two views. Initialize both before use, and track which is current. The performance hit is small, and is complete before the views are visible; barring a pathological case, the memory hit is negligible on a modern computer. (You may be able to remove the (instance?) variable toRight, which you'd otherwise have to keep in sync, and replace it with _activeBox == _rightBox.)
>
> (I'm curious: Do you need the decoration of an NSBox? Would an NSView do as well?)
>
> — F
>
> --
> Fritz Anderson
> Xcode 4 Unleashed: 4.5 supplement for free!
> http://www.informit.com/store/xcode-4-unleashed-9780672333279
>
_______________________________________________
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