Re: NIB/XIB created objects, should they be released in -[dealloc]?
Re: NIB/XIB created objects, should they be released in -[dealloc]?
- Subject: Re: NIB/XIB created objects, should they be released in -[dealloc]?
- From: Dave Camp <email@hidden>
- Date: Mon, 23 Nov 2009 08:34:56 -0800
On Nov 23, 2009, at 8:13 AM, Michael A. Crawford wrote:
> I wouldn't have though so. I would assume that since I did not allocate them directly, I don't need to clean them up. I've just inspected some code that declares properties that are marked as outlets and whose member variables are allocated in the NIB file. When the class' dealloc method is called, it calls release for said properties.
>
> I would assume this is bad form. But I would like to know if I'm mistaken and if this is valid.
Actually, that is correct. The retain/release rules for nibs are documented at http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html#//apple_ref/doc/uid/10000051i-CH4-SW6
Note that they are different for Mac OS X and iPhone.
Dave
_______________________________________________
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