单击Dock图标时,如何打开“应用程序”窗口? [英] How do you make the Application window open when the dock icon is clicked?

查看:255
本文介绍了单击Dock图标时,如何打开“应用程序”窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我惊讶这不会自动发生,但是我想在点击Dock图标时自动打开应用程序窗口。

I'm surprised this doesn't happen automatically, but I would like my applications window to open automatically when the Dock icon is clicked.

只是为了澄清,当我打开应用程序时,窗口自动打开,但是当我单击窗口的十字架,但让应用程序运行时,窗口将不会打开,当我单击dock图标。

Just to clarify, when i open the app, the window automatically opens, but when I click the cross for the window but leave the App running, the window won't open when i click the dock icon.

推荐答案

在您的应用程序代理中实现 - (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag 请检查文档以了解返回值的详细信息。

Implement - (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag in your app delegate. Check the documentation for the details of the return value.

基于文档的应用程序和非基于文档的应用程序的行为略有不同。如果基于文档的应用程序的dock图标被点击时没有打开的窗口,那么它将创建一个新文档。如果没有打开的窗口,当非基于文档的应用程序的dock图标被点击,那么它将什么也不做。

Document based apps and non-document based apps behave slightly differently. If there are no open windows when the dock icon of a document based app is clicked then it will create a new document. If there are no open windows when the dock icon of a non-document based app is clicked then it will do nothing.

这篇关于单击Dock图标时,如何打开“应用程序”窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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