在全屏模式下创建NSWindow [英] Creating NSWindow in fullscreen mode
本文介绍了在全屏模式下创建NSWindow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法将NSWindow创建为全屏模式? NSWindow有ToggleFullscreen:selector,但是它创建的窗口正常,并动画到全屏版本,这不是我想要的。
Is there a way to create a NSWindow into fullscreen mode? NSWindow has the ToggleFullscreen: selector but then it creates the window normally and animates it to the fullscreen version which isn't what I want. Any other way of doing it?
推荐答案
首先找到屏幕尺寸
NSRect screenRect;
NSArray *screenArray = [NSScreen screens];
unsigned screenCount = [screenArray count];
unsigned index = 0;
for (index; index < screenCount; index++)
{
NSScreen *screen = [screenArray objectAtIndex: index];
screenRect = [screen visibleFrame];
}
screenRect
size,现在创建一个窗口,并将 NSWindow
大小设置为屏幕大小。
screenRect
contain Screen size, now creat a window and set NSWindow
size to screen size.
unsigned int styleMask = NSTitledWindowMask
| NSMiniaturizableWindowMask;
myWindow = [NSWindow alloc];
myWindow = [myWindow initWithContentRect: screenRect
styleMask: styleMask
backing: NSBackingStoreBuffered
defer: NO];
[myWindow setTitle: @"This is a test window"];
这篇关于在全屏模式下创建NSWindow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文