All pastes #253680 Raw Edit

Untitled

public text v1 · immutable
#253680 ·published 2006-11-21 00:08 UTC
rendered paste body
#import "alertHandle.h"

@implementation alertHandle

- (IBAction)close:(id)sender
{
timer = [[NSTimer scheduledTimerWithTimeInterval:0.02 target:self selector:@selector(fade:) userInfo:nil repeats:YES] retain];

}

- (void)fade:(NSTimer *)theTimer
{
    if ([window alphaValue] > 0.0) {
        // If window is still partially opaque, reduce its opacity.
        [window setAlphaValue:[window alphaValue] - 0.1];
    } else {
        // Otherwise, if window is completely transparent, destroy the timer and close the window.
        [timer invalidate];
        [timer release];
        timer = nil;
        
        [window close];
        
        // Make the window fully opaque again for next time.
        [window setAlphaValue:1.0];
    }
}


@end