3

Hi I like to run an OSx View with an WebView init in fullscreen (so big as the current screen is not the Lion fullscreen mode), is there any code for that?

4

3 回答 3

5

抱歉,这有点晚了,但最简单的方法是:

[yourWindow toggleFullScreen:@""];

只要把它放在你的- (void)applicationDidFinishLaunching,它就会自动进入全屏。希望这可以帮助!

于 2013-01-02T13:57:32.557 回答
3

做这个:

int width = [[NSScreen mainScreen] frame].size.width;
int height = [[NSScreen mainScreen] frame].size.height;

[yourWindow setFrame:NSMakeRect(0, 0, width, height) display:YES];

intwidth并将height获取您的屏幕宽度和高度,然后使用这些 int 设置窗口的框架(具有您的 web 视图的窗口)。
我希望这就是你要找的。

于 2012-10-29T21:19:06.563 回答
1

Xcode 8,OSX 10.10,我能找到的唯一工作代码如下,放在 applicationDidFinishLaunching 中:

[[[[NSApplication sharedApplication] windows] lastObject] toggleFullScreen:nil];
于 2016-10-19T19:07:22.317 回答