Re: Dialogs and NIB's
Re: Dialogs and NIB's
- Subject: Re: Dialogs and NIB's
- From: Mike Ferris <email@hidden>
- Date: Fri, 20 Dec 2002 09:42:54 -0800
I would suggest a general rule of thumb for nib files in large scale
applications should be: one window per nib. For disembodied NSView
objects this is often true as well, although there are cases where I
would definitely put multiple top-level views (and maybe also one
window) in a nib.
Loading UI should be done on demand, and should be minimal. So you
don't usually want to load a bunch of windows you're not going to use
now (or possibly at all).
If you use NSWindowController to load your nib files then when you
release the window controller all the nib objects will go away too
(unless someone else grabbed hold of them). So unloading should be
pretty easy.
And, if you have a panel that will be used in multiple circumstances
(or even just with any number of document windows), you should make an
NSWindowController class that deals with the panel and let clients that
need it interact with the controller. Note that for app-modal panels a
sharedInstance-style API is a good idea so you only have one panel that
is shared among clients who need it, but that this will not generally
be appropriate for sheets since it is possible for multiple windows to
want to show the same sheet at the same time. But even for sheets,
don't create them until you need them.
Mike
Begin forwarded message:
From: Alan Nilsson <email@hidden>
Date: Thu Dec 19, 2002 10:54:33 PM US/Pacific
To: <email@hidden>
Subject: Dialogs and NIB's
So I was just curious how most people handle dialogs & sheets in larger
applications.
Lets say we have an application that will have many dialogs (or
sheets) and
each will require a couple of different pieces of information.
Furthermore,
lets say about 1/4 of these will be used from more than one window.
Would it be better to pack all these dialogs into one nib and load the
nib
when a dialog was needed? Would it be better to include the dialog
with the
window (panel) nib it is associated with (in which case we have some
duplication)?
Everything I have done so far has included the dialog in the same nib
as the
window which makes it really easy to make the connections, but it
seems to
me that the NSWindowController class is more suited (not that it won't
work)
to dealing with a single window in the nib.
If all the dialogs are in a single nib, how difficult is it to load (
and
unload the nib ) and make the appropriate connections?
Comments . . . Discussion . . . Preferences . . . Your mothers shoe
size
Anyone?
Alan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.