On Mon, Feb 7, 2011 at 2:54 PM, Bruce Cresanta <[email protected]> wrote:
> Ii have two subclasses of NSDocument. One of the subclasses only ever needs
> one instance window. How do I query NSWindowController for the open window,
> and if that fails, create it. Sorry for the confusion.
Override -makeWindowControllers. The default calls -windowNibName, and
loads a new instance of the named Nib for every document, but you can
change that behavior to re-use a single window controller:
- (void)makeWindowControllers {
static NSWindowController *windowController;
if (!windowController) {
windowController = [[NSWindowController alloc]
initWithWindowNibName:@"MyDocumentNib" owner:self];
}
[self addWindowController:windowController];
}
sherm--
--
Cocoa programming in Perl:
http://camelbones.sourceforge.net
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]