Open another xib file.

So in my app I have 3 xib files. MainMenu.xib, AboutTheDev.xib, and CreditsPage.xib

How do I open another xib without closing MainMenu.xib. (I have an action binded in the toolbar to open AboutTheDev.xib.

So basically,

on aboutTheDev_(sender)
          --Code to open AboutTheDev.xib
end aboutTheDev_

You have two practical choices:

  • Set up a separate script that is a subclass of NSWindowController that uses continue initWithWindowNibName:“NameOfNib” in an init handler, set it as owner of the nib, and create a singleton instance when required;

  • Use NSBundle’s loadNibNamed:owner:topLevelObjects: method to load it, making your app delegate the owner;

  • Put the stuff in a single nib.

The former is Cocoa best practice, but it’s not straight-forward. The latter is generally much more practical in ASObjC projects. I’m not sure the second buys you much of an advantage.