Re: CALayer - delegate not being called?
Re: CALayer - delegate not being called?
- Subject: Re: CALayer - delegate not being called?
- From: "stephen joseph butler" <email@hidden>
- Date: Wed, 28 Nov 2007 01:33:09 -0600
On Nov 28, 2007 1:02 AM, Paul Goracke <email@hidden> wrote:
> I'll go along with that; I didn't find specifics when I did a _very_
> cursory search. Since I tend to use 'self' as a delegate, I rarely run
> into the situation of whether to retain a delegate created solely for
> that purpose. Maybe autorelease isn't appropriate, but is retain-
> following-init ever necessary?
Nope, you're absolutely right. I can't think of a reason to alloc-init-retain.
> As there seems to be no held reference
> to the SimpleDelegate here, where would he call release since the
> layer won't do it?
He could call [[self.layer delegate] release] before releasing the
layer itself. Personally, I'd stuff it in a property or ivar.
> I believe "self.layer = main" is retaining it before it can get
> autoreleased.
Good question. I haven't been able to take a look at the Obj-C 2.0
stuff yet (my projects have all been PHP lately... grr) but taking a
quick look at the docs ISTM that properties are only assigned by
default, not retained. This *should* generate a compiler warning
though.
So back to you, Neil Clayton. Couple questions:
1) Are you using GC?
2a) Are you using "@property(retain) CALayer *layer" or just
"@property CALayer *layer"?
2b) And if it's the latter, are you getting a compiler warning that
you're ignoring?
_______________________________________________
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