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: Shawn Bakhtiar <email@hidden>
- Date: Fri, 16 Mar 2012 10:54:03 -0400
- Importance: Normal
> Subject: Re: NSViewAnimation fade[In/Out]effect not working
> From: email@hidden
> Date: Thu, 15 Mar 2012 20:09:25 -0700
> To: email@hidden
>
> 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.
>
>
Ok so now I'm thoroughly confused.
The API description of addSubView for an NSView is "Adds a view to the receiver’s subviews so it’s displayed above its siblings." Don't I need to add all the views to the NSDocument's conentView. This only happens once in windowControllerDidLoadNib?
According to setHidden "It remains in its superview’s list of subviews, however, and participates in autoresizing as usual", which is what should be happening at the end of the fadeout animation.
_______________________________________________
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