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 00:18:41 -0600
On Nov 28, 2007 12:12 AM, Paul Goracke <email@hidden> wrote:
> BTW, this line scares me:
>
> > [layer setDelegate:[[[SimpleDelegate alloc] init] retain]];
>
> You have the implicit retain from "init", then you're retaining again,
> then I assume the layer also retains it in setDelegate. Are you sure
> you don't mean "autorelease" instead of "retain"?
I don't know much about CoreAnimation, but in the delegate model
delegates are typically *NOT* retained. Autorelease would be
inappropriate here. The best thing to do would be to store the
SimpleDelegate instance elsewhere and make sure to release it at the
end.
This is only if you're not using garbage collection (in which case the
release is impotent). But if you're not using GC... then this line
here could be the whole problem:
> CALayer *layer = [CALayer layer];
This needs to be retained somewhere. Otherwise, it gets released after
the first run through the run loop (which would explain why your
delegate is never called!).
_______________________________________________
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