Cocoa 基于文档的应用程序中的更改窗口
我在基于 Cocoa-Document 的应用程序中有一个窗口。我想让这个应用程序没有标题栏。我知道如何在常规 Cocoa 应用程序中执行此操作,因为在基于 Cocoa-Document 的应用程序中有一个名为“窗口”的窗口,我没有看到任何窗口声明。所以我的问题是如何在 Cocoa Document_based 应用程序中制作无边框窗口? 谢谢
I have one window in a Cocoa-Document based application. I want to make this application have no titlebar. I know how to do this in a regular Cocoa app because there is a window called "window" in Cocoa-Document based apps I don't see any window declarations. So my question is how to I make a borderless window in a Cocoa Document_based app?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看文档的 nib 文件。在基于文档的应用程序中,这通常称为“MyDocument.xib”。您可以扔掉旧窗户并用您喜欢的类型替换它。只需记住将其连接到文件所有者中适当的插座即可。
Look in the document's nib file. In a document-based application, this is often called "MyDocument.xib". You can get rid of the old window and replace it with the type you prefer. Just remember to connected it to the appropriate outlet in File's Owner.
NSDocument
[子类] 在文档和文档窗口之间有一个NSWindowController
。通常,您可以在 NSWindowController 中进行子类化,例如创建一个具有多个窗口的文档。在这种情况下,您可能会子类化
NSWindowController
来自定义窗口的创建。或者,您可以对NSWindow
进行子类化,并让您的文档使用您的子类而不是通用的NSWindow
。请参阅基于文档的应用程序指南。 FAQ 包含有关子类化和
NSWindowController
角色的概述信息。An
NSDocument
[subclass] has anNSWindowController
between the document and the document's window. Typically, you'd subclass inNSWindowController
to, say, create a document that has multiple windows.In this case, you'll likely subclass
NSWindowController
to customize the creation of your window. Or you could subclassNSWindow
and have your document use your subclass instead of the genericNSWindow
.See the Document-Based Application guide. The FAQ contains overview information on subclassing and the role of
NSWindowController
.