我以这种方式全屏显示:

NSRect frame = [[NSScreen mainScreen] frame];

// Instantiate new borderless window
fullscreenWindow = [[NSWindow alloc] initWithContentRect:frame
                    styleMask:NSBorderlessWindowMask
                    backing:NSBackingStoreBuffered defer: NO];

startingWindow = [self window];
[startingWindow setAcceptsMouseMovedEvents:NO];
[startingWindow orderOut:nil];

if(fullscreenWindow != nil)
{
    // Set the options for our new fullscreen window
    [fullscreenWindow setReleasedWhenClosed: YES];
    [fullscreenWindow setAcceptsMouseMovedEvents:YES];
    [fullscreenWindow setContentView: self];
    [fullscreenWindow makeKeyAndOrderFront:self ];
    [fullscreenWindow setLevel: NSPopUpMenuWindowLevel-1];
    [fullscreenWindow makeFirstResponder:self];
}


切换到全屏模式后,keyDown和keyUp无效。
如何使它正常工作?

提前致谢。

最好的问候Chudziutki

最佳答案

你为什么要自己做所有这些工作?只需向您的视图发送-enterFullScreenMode:withOptions:消息。

10-04 09:55