How to wait for an animator to finish?
cocoa, objective-c
Solution
[[window animator] setAlphaValue:0.0];
[window performSelector:@selector(performClose:) withObject:self afterDelay:[[NSAnimationContext currentContext] duration]];
Problem
This is probably a simple question but I can't seem to figure out how to do it. Basically all I want to do is fade a window before closing it: ``` [[window animator] setAlphaValue:0.0]; [window close]; ``` This works fine without the [window close], but when that is included the window seems to close it before the animation finishes (which is obviously not what I want); the same seems to happen for orderOut:, performClose:, etc. Is there any way to avoid this?