我有以下代码:
- (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];
}
什么是问题?
谢谢。