Re: Re: Should I retain/release IBOutlet?
Re: Re: Should I retain/release IBOutlet?
- Subject: Re: Re: Should I retain/release IBOutlet?
- From: "Julien Jalon" <email@hidden>
- Date: Thu, 18 May 2006 01:06:42 +0200
On 5/18/06, mmalcolm crawford <email@hidden> wrote:
On May 17, 2006, at 1:02 PM, Eric wrote:
> On 5/17/06, Julien Jalon <email@hidden> wrote:
>> object -> object IBOutlet link does not suppose any retain-
>> release. If
>> you have a top-level object instantiated by the nib-loading linked to
>> an other object using IBOutlet, this top-level object is not
>> considered having any ownership to that other object so does not need
>> to release it.
>> Nobody can answer your question "If my custom controller class
>> contains IBOutlet to other objects in the nib (like UI element),
>> should
>> the custom controller retain its IBOutlets" as we don't know what the
>> relationship between your controller and that UI element is meant to
>> be. If you consider that the controller needs ownership to that
>> element, you need to add an extra retain after nib-loading ensuring
>> that your controller will prevent the element to be deallocated
>> without its consent.
>>
This is misleading/inaccurate/wrong.
I don't see what's misleading/inaccurate/wrong here. What I state is
that, in itself, linking two objects using IB (one as an outlet of the
other) will lead to no extra retain so outlets makes no supposition to
any object ownership. The fact that "when you load a nib file, all its
top level objects have a reference count of one" means that file owner
is considered owning the top level objects (and has to release them if
needed).
> So I can kind of consider IBOutlet to be a type of weak reference.
>
As a *general* statement, no.
IBOutlet is simply a flag used specifically by Interface Builder. It
has no other semantics. Look to see what it's defined as...
It has no semantic, except it clearly supposes that the corresponding
marked ivar will likely be set using IB outlet link. So the ivar will
likely be a weak-reference.
--
Julien
_______________________________________________
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