2011-06-14 57 views
0

我的申請有兩個類:exampleAppDelegateexampleController源文件的組織

我輸入exampleController.hexampleAppDelegate.mexampleAppDelegate.hexampleController.m

當我嘗試在exampleAppDelegate類使用插座或行動從exampleController類,編譯器返回以下錯誤:

use undeclared identifier and action not found.

同樣的問題,當我嘗試在exampleController使用變量從exampleAppDelegate發生。

我在做什麼錯?

+2

類名應以w /大寫字母開頭,順便說一句。 – bbum 2011-06-14 17:49:02

+1

[解決方案1](http://stackoverflow.com/questions/2228242/how-to-access-string-variable-in-one-view-controller-to-another-view-controller)[解決方案2](http ://解決方案3](http://stackoverflow.com/questions/) 1685964/how-to-pass-a-string-value-from-one-view-controller-to-another-view-controller)[解決方案4](http://stackoverflow.com/questions/6166376/how-do -i-access-a-variable-in-one-view-controller-from-another-view-controller)[解決方案5](http://stackoverflow.com/questions/3008967) – Aravindhan 2011-06-14 17:47:56

回答

0

如果您希望跨多個文件使用相同的方法/選擇器處理事件(如UIControlEventTouchDown ...),請嘗試使用addTarget:action:forControlEvents:方法而不是通過IBAction(接口構建器)進行添加。
另外,我不認爲你在控制器中導入委託的方法是正確的。

+0

我的問題關於可可,而不是可可觸摸。 – 2011-06-18 03:56:49