0

当主窗口进入全屏模式时,我试图让 NSPanel 填充第二个监视器。

我将面板上的“全屏”设置为“辅助窗口”,它会留在屏幕上,我可以手动将它拖到另一台显示器上,这很好。但是,如果我尝试以编程方式执行此操作,它会移动到另一个空间(尽管它在正确的屏幕上最大化)。

-(void)windowDidEnterFullScreen:(NSNotification *)notification
{
    NSLog(@"Now in full screen");
    NSArray *screens = [NSScreen screens];

    for (NSScreen *screen in screens) {
        if ([self.window.screen isEqualTo:screen]) {
            NSLog(@"Main Window assigned to screen:%@",screen);
        } else {
            NSLog(@"Assigning auxPanel to screen:%@",screen);
            NSRect screenRect = screen.frame;
            [self.auxPanel setFrame:screenRect display:YES];
        }
    }
}

提前致谢。

4

1 回答 1

0

I'm not sure why the Title Bar needs to be enabled, but I just added:

[self.auxPanel setStyleMask:NSBorderlessWindowMask];

and it seems to work well enough.

于 2012-08-29T16:56:30.433 回答