“bezierPathWithOvalInRect”的参数 1 的类型不兼容;错误
我有以下代码:
- (void)drawRect:(NSRect)dirtyRect
{
[[NSBezierPath bezierPathWithOvalInRect:[self theRect]] stroke];
}
- (NSRect)theRect
{
return NSMakeRect(1, 1, 1, 1); // made up some values
}
当我编译时,它显示“‘bezierPathWithOvalInRect’错误的参数 1 的类型不兼容”。然而,当我这样做时,它起作用了:
- (void)drawRect:(NSRect)dirtyRect
{
NSRect theRect = NSMakeRect(1, 1, 1, 1);
[[NSBezierPath bezierPathWithOvalInRect:theRect] stroke];
}
问题是什么?
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否将
- (NSRect)theRect
放入标题中?它还说您的程序可能不会响应
-theRect
吗?Did you put
- (NSRect)theRect
in your header?Also does it say your program might not respond to
-theRect
?