我似乎无法在 IB 和 XCode 之间连接任何 IBOutlet

发布于 2024-08-19 22:24:08 字数 288 浏览 4 评论 0原文

我使用内置的“标签栏”模板创建了一个新的 iPhone 项目。

我在视图中放置了一些滑块、标签、文本字段。

我为上述 UI 对象添加了所需的代码:“IBOutlet、@property、@synthesize 和 release”。

它保存并编译时没有任何错误或警告。

我尝试通过按住 Control 键并拖动来连接我的连接,但没有看到任何 IBOutlet 出现在列表中。我似乎无法将 IB 的任何出口“连接”到我的代码。 (我的 IBActions 都连接正常)

我做错了什么?

I created a new iPhone project using the built-in "tab bar" template.

I put a few sliders, labels, textfields in the view.

I added in needed code for: "IBOutlet, @property, @synthesize, and release" for the above UI objects.

It saves and compiles without any errors or warnings.

I try to hook-up my connections with control-drag, but don't see any of my IBOutlets appearing in the list. I can't seem to "connect" any outlets from IB to my code.
(My IBActions all connect fine)

What did I do wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沉溺在你眼里的海 2024-08-26 22:24:08

我想问题是您需要告诉 Interface Builder 您尝试将这些 UI 对象连接到的对象是您自己的子类。

例如,如果您尝试通过“文件所有者”代理对象连接它们,请选择“文件所有者”并转到“工具”->“文件所有者”。身份检查员。在“类”文本字段中,输入自定义子类的名称。现在 IB 知道要检查该类的头文件中的自定义 IBOutlet 和 IBActions。

I imagine the issue is that you need to tell Interface Builder that the object you're trying to connect those UI objects to is your own subclass.

For example, if you're trying to connect them through the "File's Owner" proxy object, select "File's Owner" and go to Tools -> Identity Inspector. In the "Class" textfield, enter the name of your custom subclass. Now IB knows to check that class' header file for custom IBOutlets and IBActions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文