• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Instantiating window from nib
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Instantiating window from nib


  • Subject: Re: Instantiating window from nib
  • From: James DiPalma <email@hidden>
  • Date: Tue, 23 Oct 2001 13:01:52 -0400

Using NSBundle to load a nib file seems to be easier for a non-NSDocument based application. I would also recommend against NSWindowControllers for things like inspectors, preferences and stuff like that.

I wouldn't say easier, but probably more efficient - NSWindowController gives you a lot of stuff you might not need if you're not creating a multi-document application. It's hard to argue easier when NSWindowController does things you would have to code for otherwise.

Not using NSWindowControllers is a design decision that allows a nib file and its associated code to be more easily understood.

NSWindowController forces a program design that I try to avoid: NSWindowControllers are either File's owner, or they are instantiated in space. I prefer controllers that are tangibly instantiated within a nib file. But, the file's owner is too important a link to a single object outside the nib to be used for an object that sets the window title. I use an NSDocument object as the file's owner (see PB document app template for an example).

BTW, I also do not subclass NSWindowController to control the ui elements in a nib file. My recommendation is to only subclass Cocoa objects to modify the behavior that they provide and not to add new responsibilities. It just seems easier, despite what documentation there is to the contrary.


-jim


  • Prev by Date: Re: Help for Help
  • Next by Date: Cocoa shell works great from PB, crashes as standalone.
  • Previous by thread: Re: Instantiating window from nib
  • Next by thread: Pre-binding Question
  • Index(es):
    • Date
    • Thread