Modal Windows and XIB files

Discussion in 'Mac Programming' started by BadWolf13, Sep 8, 2010.

  1. macrumors 6502

    Joined:
    Dec 17, 2009
    #1
    I'm reading up on Modal windows, and based on the documentation, it seems like the only way to use runModalForWindow: is if the window I want to run as a modal is included in the XIB file for the main application. Am I correct in this, or can I store that window in a separate XIB file and call it with that method?
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    You can store the window anywhere. Generally though, you should have one window per nib, so you're not loading resources unnecessarily. NSWindowController makes this easy.
     
  3. thread starter macrumors 6502

    Joined:
    Dec 17, 2009
    #3
    That's what I was thinking, since this "modal" window won't be used in every instance, I don't want to use unnecessary resources. If said window was in a separate XIB file but had a window controller called myWindowController, could I use a code like;

    Code:
    runModalForWindow:[myWindowController window]
    Would that work?
     

Share This Page