• 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: Scott Anguish <email@hidden>
  • Date: Tue, 5 Feb 2008 09:46:17 -0800

well the way he's doing it is fine, if he adds a setNeedsDisplay at the end.

you need to explicitly tell it to cache the data.

but that wouldn't account for the layer being nil.

if the method ever getting called??


On Feb 5, 2008, at 1:26 AM, Brian Christensen wrote:

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

_______________________________________________

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

_______________________________________________

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


References: 
 >ScreenSaverView and Core Animation (From: Brian Williams <email@hidden>)
 >Re: ScreenSaverView and Core Animation (From: Brian Christensen <email@hidden>)

  • Prev by Date: Re: Memory(?) issue
  • Next by Date: Re: Type introspection with NSMethodSignature, deprecated NSObjCValueType?
  • Previous by thread: Re: ScreenSaverView and Core Animation
  • Next by thread: <ignored selector>
  • Index(es):
    • Date
    • Thread