0
我有一個自定義的init方法爲我SecondViewController : UIViewController
爲什麼我的方法找不到?
-(id) initWithFirstViewController:(FirstViewController *)theFirstViewController
{
self = [super init];
fvc = theFirstViewController;
return self;
}
所以在我FirstViewController
我打電話與FirstViewController
作爲參數的一個實例,這個init方法。其他地方的SecondViewController
我用這個傳遞intance:
[fvc setSomething];
被執行的方法,但我得到一個警告:
方法
-setSomething
未找到(返回類型默認爲id
)
如何解決這個問題?
請引用完整的錯誤信息(它表示方法調用被髮送到哪種類型的對象)。另外,FirstViewController實際上是否有'setSomething'方法? – DarkDust 2011-05-02 06:14:56
它說「語義問題」並完全顯示我發佈在我的問題中的警告,方法存在並執行 – 2011-05-02 06:17:12
因此,這是編譯時錯誤而不是運行時錯誤?回到我的問題,FirstViewController'確實實現了這個方法嗎?你有沒有導入相應的'.h'文件在哪裏定義? – DarkDust 2011-05-02 06:19:32