如何创建以"Open ..."启动的基于文档的OS X应用程序;对话 [英] How to Create a Document-Based OS X App that Launches with "Open..." Dialog

查看:67
本文介绍了如何创建以"Open ..."启动的基于文档的OS X应用程序;对话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾经用一个窗口来开发非基于文档的应用程序,但是现在我正在使用基于文档的应用程序,该应用程序是使用Xcode 5中基于文档的模板创建的.启动后会生成一个新的无标题文档.我希望我的应用程序不像自动创建一个新文档那样显示打开..."对话框,就像Xcode,TextEdit和其他Apple应用程序一样.我该如何实施呢?是否可以在某处设置一个标志来显示该对话框而不是一个新文档,还是必须创建一个应用程序委托以在启动时显示该对话框?感谢您的建议.

I am used to developing non-document-based applications with a single window, but now I am working on a document based application that I created using the document-based template in Xcode 5. When I run my application, it opens a new untitled document upon launch. Instead of automatically creating a new document, I would like my application to display an "Open..." dialog much like Xcode, TextEdit, and other Apple apps do. How do I go about implementing this? Is there a flag somewhere that I can set to show the dialog instead of a new document, or do I have to create an application delegate that shows the dialog upon launch? Thanks for your advice.

推荐答案

这将是自定义的行为.

在您的应用程序控制器中,覆盖

In your application controller override applicationShouldOpenUntitledFile: to prevent opening a blank document at startup, then display the file dialog.

这篇关于如何创建以"Open ..."启动的基于文档的OS X应用程序;对话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆