Re: loadNibNamed:owner: Who disposes of the loaded objects?
Re: loadNibNamed:owner: Who disposes of the loaded objects?
- Subject: Re: loadNibNamed:owner: Who disposes of the loaded objects?
- From: Eric Friedman <email@hidden>
- Date: Thu, 25 Sep 2003 08:20:32 -0700
The link is definitely on that page: here's the path I followed when I
found it: Cocoa Documentation->AppKit->NSBundle_Additions->Loading
Resources->What happens when a nib file is loaded.
As far as I understand it, your "owner" needs to release the things
that are visible in the Interface Builder window that shows the
contents of your nib. (the one that has "File's owner" and "First
Responder" and to which you option drag connections for outlets and
such. You do not need to release every view that gets inserted within
those objects, just the "top" ones that appear in that IB window.
Eric
On Thursday, September 25, 2003, at 05:10 AM, M. Uli Kusterer wrote:
At 16:52 Uhr -0700 24.09.2003, Matthew Formica wrote:
<http://developer.apple.com/documentation/Cocoa/Conceptual/
LoadingResources
/Concepts/NibFileLoaded.html>
"Releasing Nib File Objects
When you load a nib file, all its top level objects have a reference
count
of one. When the objects are no longer needed, another object needs to
release them. That other object is usually the file's owner.
I don't think there's a link to this page anywhere on the page that
documents loadNibNamed:owner:, is there? I option-clicked
loadNibNamed: and then looked around starting there, but didn't find
anything. It'd be helpful if there was a link at the top with all the
other "Techniques and Concepts" entries on that page pointing to this.
Do I have to file a bug on this, or could you forward that info to
the documentation team?
Note that NSWindowController automatically releases its nib file's
objects
for you. Also, NSWindow has a isReleasedOnClose attribute, which
automatically releases the window for you when it's closed."
If I want to provide the same behavior as NSWindowController in my
app, how do I determine what objects are in my NIB file? Currently,
all objects are in an NSView resp. an NSPanel, but later there may be
other objects in there, and I'd like to avoid leaking anything.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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.
_______________________________________________
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.