XIB 实例化对象的 IBOutlet 为零
我设置了一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每 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 outletsprobablyare not wired wheninit
, etc., are called on the objects.