2011-06-14 60 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