2010-02-05 106 views
0

參數1,我有以下代碼:不兼容類型的「bezierPathWithOvalInRect」錯誤

- (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]; 
} 

什麼是問題?

謝謝。

回答

2

你把- (NSRect)theRect放在你的標題中了嗎?

也是說你的程序可能不會迴應-theRect

+0

謝謝。問題是我沒有在頭文件中聲明它。 – chrisgoyal 2010-02-07 00:56:35