Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6114747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:00:41+00:00 2026-05-23T15:00:41+00:00

When does the keyWindow get created? I thought the NSWindow would be created before

  • 0

When does the keyWindow get created?

I thought the NSWindow would be created before the corresponding view controller’s updateView method was called (Which I call in response to awakeFromNib), however if I create an alert sheet using NSApp’s keyWindow, it does not appear correctly.

If I place a button on that view, however, and then bring up the alert when the user clicks on it, the keyWindow is defined, and the alert displays correctly (as expected).

My Application Delegate is almost completely empty.

I don’t actually want to display the alert at startup, but I do want to know when the key window is set up. 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:00:41+00:00Added an answer on May 23, 2026 at 3:00 pm

    When does the keyWindow get created?

    -[NSApp keyWindow] points to an existing window (e.g. a window that has already been loaded from a nib file) that is currently the key window, typically by sending it -makeKeyAndOrderFront:.

    When an application starts, Cocoa:

    1. Loads the main nib file;
    2. Unarchives the contents of the nib file and instantiates its objects;
    3. Reestablishes the connections defined in the nib file;
    4. Sends -awakeFromNib to (a subset of) the nib file objects;
    5. Displays windows that have been marked as Visible at launch time;

    as described in the Resource Programming Guide.

    If the nib file contains a single window, that window becomes key upon being shown provided it can become a key window, and this happens after -awakeFromNib has been sent.

    Also, the documentation for -[NSApplication keyWindow] states that:

    This method might return nil if the application’s nib file hasn’t finished loading yet or if the receiver is not active.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how to get IntelliSense to work reliably when working in C/C++
Does anyone know where Control.ShouldSerializeVisible is called from? The Reflector does not show it
Does anyone know if it's possible to display items on a calendar view (on
Does anyone know if there is a way to get a list of controls
Does jQuery 1.5.1 support attribute selectors in the closest method? Given the structure below,
Does anyone know the function of the command vmware-vim-cmd vimsvc/connect (vimid). I thought that
Does anyone know of a program or script which lists all the files in
Does anyone know, what an XMLHttpRequest enables a web page to do, which cannot
Does anyone have any suggestions for the best / simplest way to view all
does someone know how I can get Sublime Text 2 to auto-hide the tabs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.