Opening a Window

Discussion in 'Mac Programming' started by Duke Leto, Jun 24, 2009.

  1. macrumors regular

    Mar 17, 2008
    I want the user to be able to open a window from another xib file by clicking a button. I created an NSWindowController subclass. It has an open: action connected to the button, its window is connected to the window, and it is the File Owner of the xib containing the window. The open: method calls loadWindow and showWindow:, but the window does not appear.

    The problem appears to be that the window variable shows up as 0x0. Why is it nil, and how can I fix it?

    I know that I have been using this forum as a crutch for what I do not know about development. Please bear with me, as I am coming from iPhone programming - where I insisted on programmatically creating interfaces.
  2. Moderator emeritus


    Jun 15, 2000
    How are you initializing the window controller in code? Are you passing it the correct nib name? Oh, and don't call loadWindow (see the docs). You just need to init the controller with the right nib name, and call showWindow:
  3. thread starter macrumors regular

    Mar 17, 2008
    Ooh... you mean to say that Cocoa doesn't magically initialize things after all?

    I should have known that Keebler elves weren't magically fixing my code!


Share This Page