Re: NSViewAnimation fade[In/Out]effect not working
Re: NSViewAnimation fade[In/Out]effect not working
- Subject: Re: NSViewAnimation fade[In/Out]effect not working
- From: Seth Willits <email@hidden>
- Date: Thu, 15 Mar 2012 20:09:25 -0700
On Mar 15, 2012, at 7:49 PM, Shawn Bakhtiar wrote:
> I am trying to fade in and out 4 different views based on the user clicking on a tool bar item (each toolbar item representing a different page (NSView) of the document.
>
> [[[wc window] contentView] addSubview:graph1View];
> [[[wc window] contentView] addSubview:msds2View];
> [[[wc window] contentView] addSubview:msds1View];
> [[[wc window] contentView] addSubview:genView];
>
> …...
>
> - (void) fadeInView:(NSView *) fadeInView fadeOutView:(NSView *) fadeOutView
> {
> [[wc window] setContentView:fadeInView];
This approach doesn't make sense. You're *immediately* removing the old view, replacing it with the new view, and then trying to fade in/out the two.
You need both views to be in the window for the entire duration of the animation. That means the new view must be in the window before the animation starts, and the old view can only be removed after the animation ends.
Instead of swapping out the content view of the window, you need to add these views as subviews of the content view, fade them as desired, and resize the window as needed.
--
Seth Willits
_______________________________________________
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