views:

243

answers:

1

Hi,

I have the following code:

- (void)drawRect:(NSRect)dirtyRect 
{
   [[NSBezierPath bezierPathWithOvalInRect:[self theRect]] stroke];
}

- (NSRect)theRect
{
   return NSMakeRect(1, 1, 1, 1); // made up some values
}

When I compile it says "Incompatible type for argument 1 of 'bezierPathWithOvalInRect' error". When I do this, however, it works:

- (void)drawRect:(NSRect)dirtyRect 
{
   NSRect theRect = NSMakeRect(1, 1, 1, 1);
   [[NSBezierPath bezierPathWithOvalInRect:theRect] stroke];
}

What is problem?

Thanks.

+2  A: 

Did you put - (NSRect)theRect in your header?

Also does it say your program might not respond to -theRect?

Convolution
Thanks. The problem was that I didn't declare it in the header file.
chrisgoyal