• 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
Re: About nswindow animation?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About nswindow animation?


  • Subject: Re: About nswindow animation?
  • From: PGM <email@hidden>
  • Date: Sat, 10 Feb 2007 14:53:01 -0500


I am concerned about the animation effect implemented using nswindow.
For example, user click the red round button at the left up corner, then I want to make my window fade out.
But using the NSViewAnimation Class, I can only capture the NSWindow content view, that is,the content view in a window, no the window self.

What you need to do is override your window's close method.

In your override of the close method, setup an NSViewAnimation object with your window as the target (documented yes, but also non- intuitive for a class called NSViewAnimation) and NSViewAnimationFadeOutEffect as the effect.

When your animation has finished, call [super close] to actually close your window.

You can also simply bypass NSViewAnimation and do in your NSWindow subclass (typed in Mail, may need some tweaking):

- (void)close
{
	float alpha;
	while((alpha = [self alphaValue] ) > 0.0){
		[self setAlphaValue:alpha - 0.2];
		usleep((useconds_t)(1000000));
	}
	[super close];
}

Good luck, Patrick
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: About nswindow animation?
      • From: Dominik Pich <email@hidden>
References: 
 >About nswindow animation? (From: Silicon <email@hidden>)
 >Re: About nswindow animation? (From: Murat Konar <email@hidden>)

  • Prev by Date: Re: Process monitoring
  • Next by Date: Re: Register a Drag destination for ANYTHING... mars-alien-spaceship included
  • Previous by thread: Re: About nswindow animation?
  • Next by thread: Re: About nswindow animation?
  • Index(es):
    • Date
    • Thread