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: Wed, 24 Sep 2003 17:19:20 -0700
The thing that was missing from this particular piece of documentation
was a definition of "top-level objects."
I guessed (correctly, I think) that this means objects that appear in
the nib contents within IB, as opposed to the various subviews for
which one might also have IBOutlet connections. If anyone from Apple
feels like passing this observation along to their documentation team,
I'd appreciate it.
On Wednesday, September 24, 2003, at 04:52 PM, Matthew Formica wrote:
From
<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 file9s owner.
Note that NSWindowController automatically releases its nib file9s
objects
for you. Also, NSWindow has a isReleasedOnClose attribute, which
automatically releases the window for you when it9s closed."
Regards,
Matthew Formica
Apple DTS Engineer - Dev Tools, G5, and Cocoa
email@hidden
On 9/24/03 4:35 PM, "M. Uli Kusterer" <email@hidden>
wrote:
Hi,
I'm using [NSBundle loadNibNamed: @"MyNibFile" owner: self]; in one
of my classes' -init method. It works like a charm, but I just
realized that I don't know how I'm supposed to dispose of the loaded
objects.
One of my NIBs contains an NSView with sub-views, another contains
an NSPanel. I have outlets in my class that are set to the loaded
objects. Do I have to release them? I know I need to when I'm dealing
with alloc, new or copy, but what about "load"?
And if I'm not responsible for releasing them, who is? Are they
autoreleased? Then why does my code work? Apple's docs are
suspiciously quiet about this. They only say the objects are loaded
into my object's zone ...
_______________________________________________
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.