Select the default window to be opened at startup
I'm working on a MacOS X (Objective-C / Cocoa) application which basically works this way : first a window is opened, requesting user's username / password. If credentials are valid, the main application is displayed.
This is what I do to open my credential window :
@implementation BetaseriesDesktopAppDelegate
开发者_Python百科
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
authWindow = [[AuthenticateWindow alloc] init];
[authWindow makeKeyAndOrderFront:nil];
[authWindow becomeFirstResponder];
}
- (void)login:(id)sender
{
NSLog(@"Login");
User *user = [[User alloc] init];
}
@end
Problem is, the main window if opened too at application startup. How can it prevent it to do so? Is it a property I must set in Interface Builder or do I have to do that in my applicationDidFinishLaunching
method? Something else?
In Interface Builder, select the window. In the Window Attributes info pane, deselect the option "Visible At Launch".
精彩评论