我有document-based应用程序,具有将第一个文件类型转换为第二个文件类型的功能。为此,我创建了包含转换内容的新文档窗口。对我来说,调用openUntitledDocumentOfType (然后发送数据)是唯一的工作方式。不幸的是,这是不可取的。ObjC的文档建议使用openUntiledDocumentAndDisplay并更改defaultType,而不是这些,但我需要将第一个类型作为默认类型。
你知道有什么更好的方法来代替不推荐的吗?
发布于 2016-01-29 23:02:27
0k,我找到了最好的方法来代替那些废弃的信息。甚至没有必要重写NSDocumentController。我只需创建新文档,加载其WindowController,将其添加到现有的NSDocumentController中,然后显示它:
NSDocument *document = [SecondDocument new];
[document makeWindowControllers];
[[NSDocumentController sharedDocumentController] addDocument: document];
[document showWindows];https://stackoverflow.com/questions/35083376
复制相似问题