I'm using a simple NSAlert based on Apple's sample code, and while it displays fine, it never disappears.
Code:
void DisplayAlert()
{
NSAlert *alert = [[NSAlert alloc] init];
NSLog(@"TEST");
[alert addButtonWithTitle:@"OK"];
[alert setMessageText:@"Yay!"];
[alert setInformativeText:@"This is an informational alert."];
[alert setAlertStyle:NSAlertStyleInformational];
[alert runModal];
NSLog(@"TEST2");
[alert.window close];
[alert release];
NSLog(@"TEST3");
}
I have tried with and without the [alert.window close] line and neither way will the alert disappear.
I have also tried making the first line [[[NSAlert alloc] init] autorelease]; but that did not help, either.
All of the NSLog messages appear.
The method you need is
-orderOut:not-close. Alert/Panel windows are not documents and are not "closed" in the usually sense. You just what them to disappear.