View Full Version : Modal Windows and XIB files

Sep 8, 2010, 10:21 PM
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?

Sep 8, 2010, 10:46 PM
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.

Sep 9, 2010, 10:34 AM
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;

runModalForWindow:[myWindowController window]

Would that work?