简体   繁体   English

基于可可文档的应用程序中的更改窗口

[英]Change Window in Cocoa Document-Based Application

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. 我知道如何在常规的Cocoa应用程序中执行此操作,因为在基于Cocoa-Document的应用程序中有一个称为“窗口”的窗口,我看不到任何窗口声明。 So my question is how to I make a borderless window in a Cocoa Document_based app? 所以我的问题是如何在基于Cocoa Document_app的应用程序中创建无边界窗口? Thanks 谢谢

Look in the document's nib file. 查看文档的nib文件。 In a document-based application, this is often called "MyDocument.xib". 在基于文档的应用程序中,这通常称为“ 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. 只需记住将其连接到文件所有者的适当插座即可。

An NSDocument [subclass] has an NSWindowController between the document and the document's window. NSDocument [子类]在文档和文档的窗口之间有一个NSWindowController Typically, you'd subclass in NSWindowController to, say, create a document that has multiple windows. 通常,您可以在NSWindowController类化,例如,创建具有多个窗口的文档。

In this case, you'll likely subclass NSWindowController to customize the creation of your window. 在这种情况下,您可能会子类化NSWindowController来自定义窗口的创建。 Or you could subclass NSWindow and have your document use your subclass instead of the generic NSWindow . 或者,您可以子类化NSWindow并让您的文档使用子类而不是通用NSWindow

See the Document-Based Application guide . 请参阅基于文档的应用程序指南 The FAQ contains overview information on subclassing and the role of NSWindowController . FAQ包含有关子类化和NSWindowController角色的概述信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM