TextFields 未加载到 NSWindowController 的子类中

发布于 2024-08-10 03:22:38 字数 520 浏览 4 评论 0原文

我正在开发第二个首选项样式面板(但首选项与特定文档相关)。我的 myDocument 文件变得有点大,因此我决定尝试使用单独的子类 WindowController 来实现。

我已经子类化了 NSWindowController。 nib 文件的所有者为 myController。它实现了 windowDidLoad 和 awakeFromNib。它有一个 TabView,每个 TabView 有几个 TextFields、一个 ComboBox、2 个 TextView 和几个按钮(取消和确定)。正在建立指向 Window、TabViews、Cancel 和 OK 按钮的指针,但指向comboBox、TextFields 和 TextViews 的指针均为零。

窗口中的所有 TextFields、TextViews 和 Button 都变得可见。 TabView 正在工作以切换视图。我可以编辑所有文本字段,但在关闭窗口时无法初始化它们或从中获取信息。

我正在使用 XCode 3.2 和 Objective-C。

我缺少什么?

艾伦

I am working on a second preferences style panel (but preferences related to a specific document.) My myDocument file is getting a little large so I decided to try using a separate subclass WindowController for the implementation.

I have subclassed NSWindowController. The nib file has myController as the owner. It implements both windowDidLoad and awakeFromNib. It has a TabView and each TabView has several TextFields, a ComboBox, 2 TextViews and a couple of buttons (Cancel and OK). The pointers to the Window, the TabViews, the Cancel and OK buttons are being established but the pointers to the comboBox, TextFields and TextViews are all nil.

The window is becoming visible with all of the TextFields, TextViews and Buttons. The TabView is working to switch views. I can edit all of the TextFields but I cant initialize them or get the info out of them when I dismiss the window.

I am using XCode 3.2 and Objective-C.

What am I missing?

Alan

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

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

发布评论

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

评论(2

最终幸福 2024-08-17 03:22:39

首先,显而易见的是:您是否检查过以确保您的 xib 中的这些插座没有断开连接?无论您使用这些工具的经验如何,这都是一个非常常见的问题。 :-)

其次,-windowDidLoad 和 -awakeFromNib 中的代码是什么?您可能想要列出这两种方法中“触及”问题插座的所有内容。您是否有可能将它们分配给其他事情?

First, the obvious: Have you checked to make sure these outlets have not become disconnected in your xib? This is a ridiculously common problem, no matter how experienced you are with the tools. :-)

Second, what of the code in -windowDidLoad and -awakeFromNib? You might want to list everything in those two methods that 'touches' the problem outlets. Is it possible you might be assigning them to something else?

北陌 2024-08-17 03:22:39

我找到了答案。这是一个命名空间问题。我有一个 setXXXTextField 函数,其中 TextField 被命名为 XXXTextField。因此,在尝试初始化指针时,它调用了我的 set 函数,该函数并不是为设置指针而设计的。

无论如何,感谢您的帮助,它让我看得更深入。
艾伦

I found the answer. It was a namespace issue. I had a setXXXTextField function where the TextField was named XXXTextField. So on attempting to initialize the pointer it called my set function which wasn't designed to set the pointer.

Thanks anyway for the help, it made me look deeper.
Alan

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