有没有办法将NSWindow创建为全屏模式? NSWindow有ToggleFullscreen:选择器,但它会正常创建窗口并将其动画为全屏版本,这不是我想要的.这样做的其他方式? 首先找到屏幕尺寸 NSRect screenRec
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包含屏幕大小,现在创建一个窗口并将NSWindow大小设置为屏幕大小.
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"];