XIB 实例化对象的 IBOutlet 为零

发布于 2024-08-26 05:11:39 字数 611 浏览 9 评论 0原文

我设置了一个 XIB,如以下屏幕截图所示:

alt text http:// /emberapp.com/jxpx777/images/interface-builder/sizes/m.png

文件的所有者是我的主窗口控制器。 XIB 还负责创建一个对象,该对象充当 MGScopeBar 视图的委托。正如您在屏幕截图中看到的,范围栏委托有一个用于搜索字段的 IBOutlet,以便它可以作为委托过程的一部分将其作为额外视图返回。

我遇到的问题是,当查询委托对象以获取附件视图时,IBOutlet NSSearchField 为零。我相当确定这与创建对象的顺序、IBOutlets 连接等有关,但我只是有点迷失在这个过程中我可以期望搜索字段存在以便范围栏delegate 可以正确引用它。

预先感谢您的任何指点。

I have a XIB set up like in this screenshot:

alt text http://emberapp.com/jxpx777/images/interface-builder/sizes/m.png

File's owner is my main window controller. The XIB is also in charge of creating an object that serves as the delegate for the MGScopeBar view. As you can see in the screenshot, the scope bar delegate has an IBOutlet for the search field so that it can return it as an extra view as part of the delegate process.

The problem I'm having is that when the delegate object is queried for the accessory view, the IBOutlet NSSearchField is nil. I'm fairly certain this has something to do with the order that objects are created, IBOutlets wired, etc, but I'm just a little lost as to where in the process I can expect the search field to exist so that the scope bar delegate can reference it properly.

Thanks in advance for any pointers.

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

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

发布评论

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

评论(1

∞梦里开花 2024-09-02 05:11:39

Apple 文档,看起来 NIB/XIB 中的所有插座都应该在对该 NIB/XIB 中的任何对象调用 awakeFromNib 之前进行连接,但是当在对象上调用 init 等时,插座可能不会连接。

Per Apple's documentation, it looks like all of the outlets in a NIB/XIB are supposed to be wired before awakeFromNib is called on any object in that NIB/XIB, but that outlets probably are not wired when init, etc., are called on the objects.

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