Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CALayer - delegate not being called?



Thank you all for the msgs - a simple call to setNeedsDisplay /
needsDisplayOnBoundsChange = YES is doing the trick. FYI - the retain was simply a carry over from desperation and should have been removed from the spike code.


--
Regards,
Neil Clayton,  http://shinywhitebox.com






On 28/11/2007, at 9:16 PM, Scott Anguish wrote:


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!).

when you add the layer to the view it'll get retained.

The problem in this case is that layers do not automatically 'draw' the content using the delegate methods. You must explicitly call the setNeedsDisplay method (or set that it needs display on bounds change, but in this case that isn't necessary)

calling setNeedsDisplay causes the delegate method to be called and the data to be cached. that cached data is then used as the 'content' for the layer.




_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >CALayer - delegate not being called? (From: Neil Clayton <email@hidden>)
 >Re: CALayer - delegate not being called? (From: Paul Goracke <email@hidden>)
 >Re: CALayer - delegate not being called? (From: "stephen joseph butler" <email@hidden>)
 >Re: CALayer - delegate not being called? (From: Scott Anguish <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.