We Recommend

Programming in Objective-C Programming in Objective-C
Programming in Objective-C is a concise, carefully written tutorial on the basics of Objective-C and object-oriented programming. The book makes no assumption about prior experience with object-oriented programming languages or with the C language (upon which Objective-C is based). And because of this, both novice and experienced programmers alike can use this book to quickly and effectively learn the fundamentals of Objective-C.


Posted By

Netzach on 02/16/09


Tagged

fade animation Objective-c


Versions (?)


Who likes this?

6 people have marked this snippet as a favorite

Netzach
jamesming
mfazekas
Blaenk
emoseman
obsessivejosh


Animate A Fade-Out Of A NSWindow With Objective-C


Published in: Objective C 


  1. - (void)fadeOutWindow:(NSWindow*)window{
  2. float alpha = 1.0;
  3. [window setAlphaValue:alpha];
  4. [window makeKeyAndOrderFront:self];
  5. for (int x = 0; x < 10; x++) {
  6. alpha -= 0.1;
  7. [window setAlphaValue:alpha];
  8. [NSThread sleepForTimeInterval:0.020];
  9. }
  10. }

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: mfazekas on April 22, 2009

What is the purpose of makeKeyAndOrderFront, why we make it key window, before we fade it out?

You need to login to post a comment.