I have wrote an OSX storyboard application that has a splash screen. It is a NSWindow with NSWindowController, without subclassing, that have a SplashViewController that subclasses NSViewController.
Here is the code of SplashViewController:
- (void)viewDidLoad {
[super viewDidLoad];
_timer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(timeOut) userInfo:nil repeats:NO];
}
- (void)timeOut
{
[self performSegueWithIdentifier:@"main" sender:self];
}
- (void)prepareForSegue:(NSStoryboardSegue *)segue sender:(id)sender
{
[_timer invalidate];
_timer = nil;
[self.view.window.windowController close];
}
This closes the window/window controller as expected.
The segue has show type and presents another NSWindowController which has MainViewController, subclass of NSViewController. When MainViewController opens a save dialog:
NSArray *a = [[NSApplication sharedApplication] windows];
NSLog(@"%ld", a.count);
NSSavePanel *savePanel = [NSSavePanel savePanel];
[savePanel setAllowedFileTypes:@[@"pdf"]];
[savePanel setDirectoryURL:[NSURL URLWithString:NSHomeDirectory()]];
[savePanel beginSheetModalForWindow:self.view.window completionHandler:nil];
an old splash window comes up (and "1" is printed). What the? I mean why it is showing up? And what NSSavePanel has to do with it?