开发者

Incompatible type for argument 1 of 'bezierPathWithOvalInRect' error

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.


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

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜