Re: Multi windows in Document-based app, but 1 Nib
Re: Multi windows in Document-based app, but 1 Nib
- Subject: Re: Multi windows in Document-based app, but 1 Nib
- From: Sherm Pendley <email@hidden>
- Date: Thu, 5 Apr 2007 18:30:54 -0400
On Apr 5, 2007, at 5:53 PM, Todd Heberlein wrote:
All the documentation for Document-based applications indicate that
if you want multiple windows displaying different aspects of a
single document (e.g., multiple views of a CAD model), then you
should subclass NSWindowController, and then have each
NSWindowController subclass load up a separate NIB in the
makeWindowControllers method.
QUESTION: Why can't I just put multiple windows in the main/
original Nib (i.e., MyDocument.nib)?
Will something break if I do (now or down the road with future OS
or X-Code releases)? What I want to do is have a primary window
representing the model/document, and then multiple (but optional)
non-editable windows showing different (graphical) views on the
same data.
It's not impossible, it's just a bad idea in many (if not most)
situations.
For instance, it precludes the notion of having one of the windows be
document-specific, with others being "shared" (like inspector panels)
among multiple documents. With all your windows in one nib, each
document will get a complete set of them.
Also, keeping them in multiple nibs allows them to be loaded lazily,
or on demand. In your case, your secondary windows are optional; why
take the time and memory to load those nibs if they may not be used?
On the other hand, if your app's workflow dictates that all of the
windows will be used at some point in each session, there's no
technical reason why you couldn't keep them all in one nib. The docs
are simply focusing on the most common use case.
sherm--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden