Initialize a window before showing it

Discussion in 'Mac Programming' started by isthisonetaken, Nov 28, 2010.

  1. macrumors regular

    Jun 29, 2006
    Hey all,

    so I have an application which starts with a login window, and after successful login opens the main window. What I would like to have happen, is once the login is successful, load the information I need from the database to populate the main window, then show the main window and close the login.

    So far, I have both windows in MainMenu.xib, the main window is hidden at launch, the login window shows, and the login code is written and works. When the login is successful I call this code:
    [blackboxWindow orderFront:self];
    		[loginWindow close];
    I have the code to initialize blackboxWindow in awakeFromNib and my problem is that I have a NSRunAlert to show me what is being returned, and that is popping up even before the login window shows.

    I feel like the problem is in the awakeFromNib, but if I put the code in the applicationDidFinishLaunching, the same problem happens. Is there a way to call something like applicationDidFinishLaunching, but just before a window is shown?


  2. macrumors G5


    Nov 25, 2005
    Well, yes. Just write some code and call it before you call orderFront.
  3. thread starter macrumors regular

    Jun 29, 2006
    There should be a smiley doing a face palm. Thanks gnasher729.

Share This Page