Re: Where to release in UIView
Re: Where to release in UIView
- Subject: Re: Where to release in UIView
- From: Greg Guerin <email@hidden>
- Date: Sat, 18 Jul 2009 12:09:41 -0700
DKJ wrote:
Yes, I realise that. What I'm wondering is where to do it, since
it's initialised in the awakeFromNib method, rather than in
initWithFrame:.
It doesn't matter where it's initialized. The only thing that
matters is who owns it.
It is not only possible, but fairly common, for an instance of some
class to acquire ownership of additional objects over time. As a
simple example, consider an instance of NSMutableArray. In order for
it to work properly, it acquires ownership of every object added or
inserted. So ask yourself what should the dealloc method of
NSMutableArray do? The answer should be obvious: it should release
every object it still owns, regardless of when the object was acquired.
You should probably reread the Memory Management section if this
isn't crystal-clear. I'm not just being pedantic about this,
either. Ownership is *the* fundamental principle behind all
questions of memory management, and if there is any question in your
mind about what ownership means or what its responsibilities are,
then rereading the memory management docs is the best thing to do.
The NSDictionary does store the CGMutablePathRefs quite nicely,
although the compiler complains about it.
Post the error message.
_______________________________________________
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