Re: Questions about Nib Object Retention
Re: Questions about Nib Object Retention
- Subject: Re: Questions about Nib Object Retention
- From: Kyle Sluder <email@hidden>
- Date: Tue, 20 Oct 2009 21:35:11 -0700
On Tue, Oct 20, 2009 at 8:55 PM, Graham Cox <email@hidden> wrote:
>> Are they retained for outlet connections?
>
> No, because if there is an outlet to them then they are owned.
This is not correct. I have built a sample project and instantiated a
custom, do-nothing NSObject subclass in my nib. It experiences the
same behavior (one allocation, one retain, and one release) whether it
is wired up to an outlet or not.
Someone needs to release your top level objects. Since your file's
owner is usually doing the nib loading, it makes sense for that object
to do the releasing of those objects. This is why the file's owner's
outlets are typically assigned, not retained. The nib loading
machinery has taken care of the retain.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden