Hey guys, I have the following sections of code that I use to fade out a modal window:
The issue in a nutshell is that on 10.5, the window never fades out, or even closes. On 10.6, everything works fine.
On 10.6, I see in the console:
On 10.5, all I see is:
I've read through the documentation for CAAnimation, etc. but I can't find anything that would suggest the behavior for running animations and calling delegate methods would differ between operating system versions.
Am I missing something? Is there a more elegant/proper way to fade out a modal window? I would like to use the "official" method, as opposed to putting together a workaround. Thanks!
Code:
- (IBAction)open:(id)sender {
if ([self alphaValue] < 1.0) {
[self setAlphaValue:1.0];
}
[self showDevicesViews];
[self start];
[NSApp runModalForWindow:self];
NSLog(@"runModalForWindow: returned");
[super orderOut:nil];
}
- (void) animationDidEnd:(NSAnimation *)animation {
NSLog(@"animationDidEnd:");
}
- (void)animationDidStop:(NSAnimation *)animation {
NSLog(@"animationDidStop:");
}
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag {
NSLog(@"animationDidStop:finished:");
[NSApp stopModal];
}
- (void)orderOut:(id)sender {
NSLog(@"self orderOut:");
[self stop];
CAAnimation *anim = [CABasicAnimation animation];
[anim setDelegate:self];
[anim setDuration:0.2];
[self setAnimations:[NSDictionary dictionaryWithObject:anim forKey:@"alphaValue"]];
[[self animator] setAlphaValue:0.0];
}
The issue in a nutshell is that on 10.5, the window never fades out, or even closes. On 10.6, everything works fine.
On 10.6, I see in the console:
Code:
11/2/10 10:25:51 AM Application[204] self orderOut:
11/2/10 10:25:51 AM Application[204] animationDidStop:finished:
11/2/10 10:25:52 AM Application[204] runModalForWindow: returned
On 10.5, all I see is:
Code:
11/2/10 10:27:31 AM Application[204] self orderOut:
I've read through the documentation for CAAnimation, etc. but I can't find anything that would suggest the behavior for running animations and calling delegate methods would differ between operating system versions.
Am I missing something? Is there a more elegant/proper way to fade out a modal window? I would like to use the "official" method, as opposed to putting together a workaround. Thanks!