Re: Basic Core Animation question
Re: Basic Core Animation question
- Subject: Re: Basic Core Animation question
- From: "Greg Sabo" <email@hidden>
- Date: Mon, 14 Apr 2008 19:26:07 -0500
I think I'm doing those things, see below:
//Setting object as delegate for CALayer
- (id) initWithFrame:(NSRect) frame {
if (self = [super initWithFrame: frame]) {
animateLayer = [CALayer layer];
[animateLayer setDelegate:self];
}
return self;
}
//drawing the view and setting setNeedsDisplay of CALayer to YES
- (void)drawRect:(NSRect)rect {
[self drawBoardBackgroundInRect:rect];
//whenever this next line is not commented out, the program crashes
//when I try to resize the window
[animateLayer setNeedsDisplay];
}
//Implementation of drawLayer: inContext:
- (void)drawLayer:(CALayer *)theLayer
inContext:(CGContextRef)theContext {
CGRect theRect = CGRectMake(0.5, 0.5, 1, 1);
CGContextSetRGBFillColor(theContext, 1, 0, 1, 1);
CGContextFillEllipseInRect(theContext, theRect );
}
Thanks for your help, you guys are awesome!
On Mon, Apr 14, 2008 at 2:21 AM, Michael Vannorsdel <email@hidden>
wrote:
> Are you implementing the drawLayer:inContext: in your delegate object and
> sure the object is set as the delegate and the draw method is called?
>
>
>
> On Apr 13, 2008, at 8:05 AM, Greg Sabo wrote:
>
> I am now, (in DrawRect) but no luck, also the program now crashes when I
> > attempt to resize the frame...
> >
> > //***********
> > - (void)drawRect:(NSRect)rect {
> > [self drawBoardBackgroundInRect:rect];
> > [animateLayer setNeedsDisplay];
> > }
> >
>
_______________________________________________
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