• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [NSApp mainWindow] weirdness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NSApp mainWindow] weirdness


  • Subject: Re: [NSApp mainWindow] weirdness
  • From: Shawn Erickson <email@hidden>
  • Date: Mon, 1 Jul 2002 20:12:59 -0700

On Monday, July 1, 2002, at 07:34 PM, Simon Fraser wrote:

When does NSApplication set up its 'mainWindow'? I'm seeing cases
where we've got a window on the screen, but [NSApp mainWindow] is
still returning null (this is often at application startup time).
Some time later, [NSApp mainWindow] will correctly return this window.

Does [NSApp mainWindow] only get set after we've been back through
the main event loop after creating the window? Or is there some
other timing wierdness involved?

From the docs for mainWindow...

"Returns the main window. This method returns nil if there is no main window, if the application's nib file hasn't finished loading, if the main window belongs to another application, or if the application is hidden."

In this case it sounds like you are attempting to access the main window before nib has finished loading.

In your apps delegate implement applicationDidFinishLaunching:(NSNotification*) to know when your app is fully loaded so you can do an final initialization needed.

-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: [NSApp mainWindow] weirdness
      • From: email@hidden (Simon Fraser)
References: 
 >[NSApp mainWindow] weirdness (From: email@hidden (Simon Fraser))

  • Prev by Date: Re: Can't cram an NSRange into an NSArray?
  • Next by Date: Re: [NSApp mainWindow] weirdness
  • Previous by thread: [NSApp mainWindow] weirdness
  • Next by thread: Re: [NSApp mainWindow] weirdness
  • Index(es):
    • Date
    • Thread