Unclear on -makeWindowControllers in doc-based app
Unclear on -makeWindowControllers in doc-based app
- Subject: Unclear on -makeWindowControllers in doc-based app
- From: Andrew Merenbach <email@hidden>
- Date: Sun, 11 Dec 2005 11:05:32 -0800
Hi, all. I've looked in the docs with regard to (what I believe to
be) relevant classes and paradigms, and this doesn't seem to be
covered at all--because I must have misunderstood, I suspect,
something about the whole paradigm involved with separating MVC in
document-based apps.
If one has a document-based application and has overridden -
makeWindowControllers, so as to put the window controller
functionality in one class and the document functionality in another,
how does one release the created window controller? As an example,
my -makeWindowControllers method now looks like this:
- (void)makeWindowControllers {
NPWindowController *windowController = [[NPWindowController
allocWithZone:[self zone]] initWithWindowNibName:[self windowNibName]];
[self addWindowController:windowController];
[windowController release];
}
This works fine, and with no instance variables needed, to boot (in
terms of basic functionality) But what about this, from the
NSDocument class documentation?
'If you create window controllers in makeWindowControllers or in any
other context, such as in response to a user event, you should invoke
this method [-addWindowController:] for each created window
controller. To remove a window controller from the list of active
controllers, send it NSWindowController’s close message.'
Would it be better for me to have an instance variable for the window
controller, and then send it a -close message from the -dealloc
method of my NSDocument subclass?
Many thanks,
Andrew
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden