Re: NSDoc and Memory
Re: NSDoc and Memory
- Subject: Re: NSDoc and Memory
- From: Bill Cheeseman <email@hidden>
- Date: Sat, 07 Sep 2002 17:56:49 -0400
on 02-09-07 4:28 PM, James DiPalma at email@hidden wrote:
>
a new "Cocoa Document-based
>
Application" from PB does set MyDocument.nib's file's owner class to
>
MyDocument and that NSDocument actually does have an IBOutlet named
>
window.
>
>
You can verify this information in IB or by looking in NSDocument's
>
header on 10.1.5; notice these lines:
>
-------------
>
- (void)setWindow:(NSWindow *)window;
>
// This method is for getting the window outlet hooked up from IB in
>
the case where the document is the nib file's owner (ie if the document
>
implements -windowNibName).
>
-------------
NSDocument's setWindow: documentation (like the comment in the header file)
goes on to say "You should not call this method. You might override it, but
overriding windowControllerDidLoadNib: is a better idea." I take all this to
mean that Cocoa calls this method internally when you've elected to make an
NSDocument subclass the nib file's owner. I assume the method does in one
step all the things I was describing as being necessary to get the document,
its window controller(s) and its window(s) connected properly. Since
developers aren't supposed to call it, it isn't much help to us.
In any event, it is not an IBOutlet. You say the NSDocument in the Cocoa
Document-based Application template declares an IBOutlet named window, but I
don't see it. The MyDocument.h header file in the template declares no
instance variables (IBOutlets or otherwise) of any kind. I've looked at the
NSDocument header file, too, and there is no "window" instance variable or
method with an id or IBOutlet type. There is a private variable named
_window, but I don't think that counts; you aren't supposed to use private
variables for anything yourself. The setWindow: method certainly is not an
IBOutlet, even apart from the usage limitations mentioned above. It's more
like a set accessor method. It does not return a value, as an IBOutlet does.
So I'm a little puzzled about what you mean.
It's certainly true that all this is confusing to first timers. My message
was an attempt to clarify. Perhaps I wasn't clear enough that I was talking
about only one approach. In my book, I do make it clear.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont -
http://members.valley.net/croquetvermont
_______________________________________________
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.