• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CALayer - delegate not being called?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CALayer - delegate not being called?


  • Subject: Re: CALayer - delegate not being called?
  • From: John Clayton <email@hidden>
  • Date: Wed, 28 Nov 2007 11:21:00 +0100

Hi Scott,

But Neil is saying that the border of the layer is visible, thus the layer must be drawing itself at some point already, right?

--
John Clayton

On Nov 28, 2007, at 9:16 AM, 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:
@mac.com


This email sent to email@hidden

_______________________________________________

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


  • Follow-Ups:
    • Re: CALayer - delegate not being called?
      • From: Scott Anguish <email@hidden>
    • Re: CALayer - delegate not being called?
      • From: Paul Goracke <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>)

  • Prev by Date: Re: Code and Decode a CGContextRef
  • Next by Date: Re: Selections in NSCollectionView
  • Previous by thread: Re: CALayer - delegate not being called?
  • Next by thread: Re: CALayer - delegate not being called?
  • Index(es):
    • Date
    • Thread