我无法在代码和Interface Builder之间建立连接 [英] I am having trouble making connections between code and Interface Builder

查看:112
本文介绍了我无法在代码和Interface Builder之间建立连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPhone SDK中有一个特殊的问题。

I am having a peculiar problem with the iPhone SDK.

我试图在开发机器上运行不同来源的几个教程。问题总是似乎在将代码连接到Interface Builder中的视图。如果我有一个按钮或数据字段(或一些其他库函数),我声明一些属性在 viewcontroller.h 文件,我启动Interface Builder通过点击 .xib 文件,并尝试通过从连接查看器中的引用插座拖动来建立连接,并且只显示可能的连接(弹出框中显示 view )。没有其他选项可用,不管有什么代码可用。有没有人体验过这个或者我缺少一些明显的东西?

I have tried to run several tutorials from different sources on my development machine. The problem always seems to be in connecting the code to a view in Interface Builder. If I have a button or data field (or some other library function) and I declare some properties in the viewcontroller.h file, I launch Interface Builder by clicking on the .xib file and attempt to make a connection by dragging from the referencing outlet in the connection viewer and the only possible connection presented (present in the pop-up box is view). No other options are available regardless of what code is available. Has anybody experienced this or am I missing something obvious?

推荐答案

在你的控制器的头文件中, $ c> IBOutlet 在您的控制和 IBAction 您想要链接在Interface Builder中链接的方法。此外,请确保您的控制器类在检查器窗口(a.k.a.文件的所有者)中被定义为XIB的类

In your controller's header file, make sure you are using IBOutlet on your controls and IBAction on your methods that you wish to link to link up in Interface Builder. Also, make sure that your controller class is defined as the "class" for the XIB in the Inspector window (a.k.a. File's Owner)

这篇关于我无法在代码和Interface Builder之间建立连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆