问题描述
我正在使用 NSWindowController
,我只是不能想到如何让它工作。如何开始使用它?
I'm looking in to using NSWindowController
and I just can't think how to get it working. How do I start using it?
推荐答案
很难回答这个问题而不知道你想要做什么。但是,如果您正在编写基于文档的应用程序,则会为您创建的每个窗口自动创建一个NSWindowController,因此您不需要特别创建。
It's difficult to answer this question without knowing what you're trying to do. However, if you are writing a document-based application, an NSWindowController is automatically created for each window you create, so you don't need to create one specially.
方式我使用NSWindowController是我为我的应用程序中的每种类型的窗口创建不同的子类。例如,我可能有一个3D应用程序与AppWireframeWindowController和AppPreviewWindowController。每个子类自动加载正确的nib文件,并有代码将文档的数据挂钩到nib中的视图。
The way I use NSWindowController is I create a different subclass for each type of window in my application. For example, I might have a 3D application with an AppWireframeWindowController and an AppPreviewWindowController. Each subclass automatically loads the correct nib file, and has code that hooks the document's data to the views in the nib.
这篇关于如何使用NSWindowController?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!