Re: Instantiating window from nib
Re: Instantiating window from nib
- Subject: Re: Instantiating window from nib
- From: Jeff LaMarche <email@hidden>
- Date: Mon, 15 Oct 2001 22:44:42 -0700
On Monday, October 15, 2001, at 10:51 AM, James DiPalma wrote:
Are there advantages to using NSWindowController? Its design seems to
provide many of its features for NSDocument (or any document) window:
all of the relevant features in the doc can easily be done in IB for a
non-document window. Using an NSWindowController simply to load a nib
file seems like an unnecessary introduction of a somewhat confusing
class.
Well, as the person who asked the original question, I'm certainly no
expert here, but NSWindowController does seem to provide some additional
functionality that is useful, although not particularly hard to
implement yourself. For one thing, it automatically cascades new
windows, and stores window size and location information in the user
defaults, restoring them the next time. These are obviously things
primarily intended for the document based application, but they can be
useful in other situations.
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.