【问题标题】:Organization of source files源文件的组织
【发布时间】:2011-06-14 17:37:42
【问题描述】:

我的应用程序有两个类:exampleAppDelegateexampleController

我将exampleController.h 导入exampleAppDelegate.m 并将exampleAppDelegate.h 导入exampleController.m

当我尝试在exampleAppDelegate 类中使用来自exampleController 类的出口或动作时,编译器返回以下错误:

使用未声明的标识符和未找到的操作。

当我尝试在exampleController 中使用来自exampleAppDelegate 的变量时,也会出现同样的问题。

我做错了什么?

【问题讨论】:

标签: objective-c cocoa


【解决方案1】:

如果您想对多个文件中的事件(如 UIControlEventTouchDown ...)使用相同的方法/选择器,请尝试使用 addTarget:action:forControlEvents: 方法添加它们,而不是通过 IBAction(界面构建器)。
另外,我认为您在控制器中导入委托的方法是不正确的。

【讨论】:

  • 我的问题是关于可可,而不是可可触摸。
猜你喜欢
  • 2010-11-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-08-09
  • 1970-01-01
  • 2011-01-16
  • 2010-09-08
相关资源
最近更新 更多