Cocoa 在全屏模式下创建NSWindow
有没有办法将NSWindow创建为全屏模式?NSWindow有ToggleFullscreen:选择器,但它会正常创建窗口,并将其设置为全屏版本,这不是我想要的。还有其他方法吗?首先找到屏幕大小Cocoa 在全屏模式下创建NSWindow,cocoa,xcode4,osx-lion,Cocoa,Xcode4,Osx Lion,有没有办法将NSWindow创建为全屏模式?NSWindow有ToggleFullscreen:选择器,但它会正常创建窗口,并将其设置为全屏版本,这不是我想要的。还有其他方法吗?首先找到屏幕大小 NSRect screenRect; NSArray *screenArray = [NSScreen screens]; unsigned screenCount = [screenArray count]; unsigned index = 0; for
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];
}
这将全屏打开窗口这不是将窗口最大化,而不是将其置于全屏模式吗?请参阅,非常好,但如何设置应用程序,以便使用故事板全屏启动?
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"];
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSRect frame=[NSScreen mainScreen].frame ;
[self.window setFrame:frame display:YES animate:YES];
}