【发布时间】:2016-05-12 07:52:58
【问题描述】:
我有一个应用程序,我在多屏幕上试用它。我有两个屏幕,当两个屏幕都进入全屏时,我想禁用第二个屏幕上的焦点,我想强制将焦点放在主屏幕上。 我尝试了找到here 的解决方案,但没有改变任何东西。
以下代码显示了我如何为我的主窗口和第二个窗口进入全屏
[self.window.contentView enterFullScreenMode:[[NSScreen screens] firstObject] withOptions:nil];
[windowArray insertObject:self.window atIndex:0];
NSRect screenRect;
NSArray *screenArray = [NSScreen screens];
for (NSInteger index = 1; index < [screenArray count]; index++)
{
NSScreen *screen = [screenArray objectAtIndex: index];
screenRect = CGRectMake(0, 0, screen.frame.size.width , screen.frame.size.height);
NSWindow *window = [[NSWindow alloc] initWithContentRect:screenRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO screen:screen];
[window.contentView setWantsLayer:YES];
window.contentView.layer.backgroundColor = [NSColor blackColor].CGColor;
[window.contentView enterFullScreenMode:[[NSScreen screens] objectAtIndex:index] withOptions:nil];
[windowArray addObject:window];
}
当两个屏幕都处于全屏模式时,当我单击第二个窗口时,我将焦点放在第二个窗口(正常事件)上,但我想禁用它并强制将焦点放在我的主窗口上。我试图在第二个屏幕上禁用鼠标事件,但.. 不工作。 如果有人可以帮助我!提前致谢
【问题讨论】:
-
您能发布一些代码并打印您的屏幕吗?我不确定你想要什么。所以帮助你会更容易。
-
完成,希望现在更清楚..
标签: objective-c xcode nswindow multiscreen