• 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: ScreenSaverView and Core Animation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ScreenSaverView and Core Animation


  • Subject: Re: ScreenSaverView and Core Animation
  • From: Brian Christensen <email@hidden>
  • Date: Tue, 5 Feb 2008 04:26:02 -0500

On Feb 5, 2008, at 03:17, Brian Williams wrote:

I am trying to get core animation to work with a ScreenSaverView.
The problem is that the layer is nil.
I have tried to setup the coreanimation layer manually but when I check with
the debugger it comes back empty.


This is in the screensaverview class init

- (id)initWithFrame:(NSRect)frame isPreview:(BOOL)isPreview
{
   self = [super initWithFrame:frame isPreview:isPreview];
   if (self) {

		self.layer = [CALayer layer];
		self.layer.frame = NSRectToCGRect(self.bounds);
		self.layer.delegate = self;
		self.layer.needsDisplayOnBoundsChange = YES;
		self.wantsLayer = YES;
   }
   return self;
}

In order for your drawLayer:inContext: delegate method to be invoked, you need to change the frame property after your "needsDisplayOnBoundsChange = YES" declaration:


self.layer = [CALayer layer];
self.layer.delegate = self;
self.layer.needsDisplayOnBoundsChange = YES;
self.layer.frame = NSRectToCGRect(self.bounds);
self.wantsLayer = YES;

As it stands with your original code, you're changing the bounds before you're telling it that you want it to redisplay when the bounds are changed.

/brian

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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: ScreenSaverView and Core Animation
      • From: Scott Anguish <email@hidden>
References: 
 >ScreenSaverView and Core Animation (From: Brian Williams <email@hidden>)

  • Prev by Date: Re: Setting an NSColor crashes - probably very simple issue
  • Next by Date: <ignored selector>
  • Previous by thread: ScreenSaverView and Core Animation
  • Next by thread: Re: ScreenSaverView and Core Animation
  • Index(es):
    • Date
    • Thread