Re: NSDocument Question
Re: NSDocument Question
- Subject: Re: NSDocument Question
- From: Sherm Pendley <email@hidden>
- Date: Mon, 7 Feb 2011 15:11:28 -0500
On Mon, Feb 7, 2011 at 2:54 PM, Bruce Cresanta <email@hidden> 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@hidden)
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:
This email sent to email@hidden