Interface Builder 不会连接按钮,但教程说它应该可以工作

发布于 2024-08-12 17:21:01 字数 553 浏览 1 评论 0原文

我一直在尝试学习 Core Data,浏览 Stack Overflow 上的问题后,我得到了一个建议:我可以尝试 Cocoa Dev Central 上的 Core Data 教程(链接)。

到目前为止,本教程中的所有内容都有意义,但是当我进行到步骤 16 时,它不允许我将 + 按钮连接到 Posts 数组控制器。我已经返回并仔细检查了每一步,但看不出哪里有问题,但它仍然不允许我连接。我正在使用最新版本的 Xcode 和 Interface Builder(上周刚刚重新下载);这可能是版本兼容性问题吗?

附录

似乎问题在于我必须通过更改检查器中的类来更改名称,并且删除了数组控制器的默认操作。将类更改回 NSArrayController 可以恢复功能,但现在无论它出现在哪里,它都显示为“Array Controller”,一旦我修复了 Authors 和 Topics 控制器,似乎使用 3 个控制器就会出现问题。

I've been trying to learn Core Data, and browsing through questions on Stack Overflow lead me to a recommendation that I try the tutorial on Core Data over at Cocoa Dev Central (Link).

Everything is making sense so far in the tutorial, but when I got to step 16, it wouldn't let me connect the + button to the Posts array controller. I've gone back and double, triple-checked each step along the way and can't see where anything is off, but it still won't let me connect. I'm using the latest versions of Xcode and Interface Builder (just re-downloaded them last week); could this be a version compatibility issue?

Addendum

Seems that the problem was in that I had to change the name by changing the class in the inspector, and that removed the default actions for the array controller. Changing the class back to NSArrayController restores functionality, but now it appears as "Array Controller" wherever it appears, which seems like it'd become problematic with 3 controllers in play once I fix the Authors and Topics controllers.

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

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

发布评论

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

评论(2

旧时浪漫 2024-08-19 17:21:02

知道了。在检查器下,使用“名称”来更改对象的名称,而不是“类”。新手错误。

Got it. Under the inspector, use "Name" to change the name of the object, not "Class". Newbie error.

听不够的曲调 2024-08-19 17:21:02

根据您的评论,您将 Posts 控制器的类从 NSArrayController 更改为名为 Posts 的自定义类。界面构建器找不到此自定义类的实现,因此没有显示任何可用于绑定的操作或出口。

将类更改回 NSArrayController 解决了问题。

(界面生成器允许您执行此操作,因为您可能想要定义自己的自定义控制器。您可以将操作和出口添加到 IB 中的对象,然后生成类并在 XCode 中添加实现。这非常有用 - 但可能会造成混淆该工具的新用户。)

Based on your comments, you changed the class of the Posts controller from an NSArrayController to a custom class called Posts. Interface builder couldn't find an implementation for this custom class, hence, did not show any actions or outlets available to bind against.

Changing the class back to NSArrayController fixed the problem.

(Interface builder lets you do this as you may want to define your own custom controller. You can add the actions and outlets to the object in IB, then generate the class and add the implementation in XCode. This is quite useful - but can confuse new users of the tool.)

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