如何使Mac OSX Cocoa应用程序全屏? [英] How to make a Mac OSX Cocoa application fullscreen?

查看:489
本文介绍了如何使Mac OSX Cocoa应用程序全屏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图让我的Mac应用程序进入全屏现在一段时间,但不能得到它的工作。根据Apple开发人员中心,我应该使用

I have been trying to make my Mac application enter fullscreen now for a while but can't get it to work. According to the Apple developer center, I should use enterFullScreenMode:withOptions: which gives me, method enterFullScreenMode not found.

无论何时何地,我都会遇到这样的情况:apple_ref / occ / instm / NSView / enterFullScreenMode%3awithOptions%3a> enterFullScreenMode:withOptions:似乎有人在将应用全屏显示时遇到问题,那么使其工作的方式是什么?

Everywhere I google there seems to be people having issues with making their app fullscreen, so what is the way to make it work?

编辑:

当然 enterFullScreenMode NSView ,我使用它在 NSWindow ;它不是我想要的视图全屏,而是窗口。我找不到 NSWindow 的任何函数。

Of course enterFullScreenMode is for the NSView and I used it on a NSWindow; it's not the view I want to have fullscreen, but the window. I can't find any function for the NSWindow though.

推荐答案

Jonathan在评论中提供的链接中所述 enterFullScreen:withOptions:有一些缺点,可以让你想撕掉你的头发。完成全屏的最好方法仍然是较老的CGDirectDisplay API。 Cocoa Dev Central有一个关于全屏应用程序的文章,其中涵盖了您需要了解的所有内容。

As mentioned in the link Jonathan provided in the comments, enterFullScreen:withOptions: has a number of drawbacks that can make you want to tear your hair out. The best way to do fullscreen is still the older CGDirectDisplay API. Cocoa Dev Central has an article on fullscreen apps that covers pretty much everything you need to know.

你会注意到这篇文章很古老,开发工具自那以后改变了很多(Project Builder!啊,老的好日子),但代码本身仍然可以工作。

You'll notice the article is pretty ancient and the dev tools have changed a lot since then (Project Builder! Ah, the good old days), but the code itself will still work.

这篇关于如何使Mac OSX Cocoa应用程序全屏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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