Re: drawRect not called when hosting Layers
Re: drawRect not called when hosting Layers
- Subject: Re: drawRect not called when hosting Layers
- From: Gustavo Pizano <email@hidden>
- Date: Fri, 7 May 2010 17:59:52 +0200
Hell Bill.
Thanks for the reply.
Yes, I realize I was just setting the ivar directly and not from the accessor.
I change it and its working now.
G.
On May 7, 2010, at 4:17 PM, Bill Garrison wrote:
>
> On May 6, 2010, at 2:32 PM, Gustavo Pizano wrote:
>
>> David thanks for the info about the drawing.
>>
>> Im looking at the zombie error, and it seems the CALayer where Im putting the animation its being deallocated, even have something like:
>>
>> CALayer * quickEdit;
>> @property(nonatomic, retain)CALayer * quickEdit;
>>
>> and in the .m file
>>
>> quickEdit = [CALayer layer];
>
> To solve your deallocation issue, you have to invoke the set accessor:
>
> self.quickEdit = [CALayer layer]; // either this...
> [self setQuickEdit: [CALayer layer]; // or this.
>
> What you've done above is assign an autoreleased CALayer instance directly to the quickEdit ivar. It is deallocated when the current runloop's autorelease pool is drained.
>
>
> Using a pattern of a distinguishing name for ivar and its corresponding property would make this more apparent. E.g.
>
> CALayer *myQuickEdit;
> @property(nonatomic, retain)CALayer * quickEdit;
> // remember to use @synthesize quickEdit = myQuickEdit in the implementation file
>
> myQuickEdit = [CALayer layer];
>
> Here, it's more apparent that you are diddling the ivar directly, and not invoking any of the property accessors that you declared.
>
> Bill
_______________________________________________
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