Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cocoa 在全屏模式下创建NSWindow_Cocoa_Xcode4_Osx Lion - Fatal编程技术网

Cocoa 在全屏模式下创建NSWindow

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

有没有办法将NSWindow创建为全屏模式?NSWindow有ToggleFullscreen:选择器,但它会正常创建窗口,并将其设置为全屏版本,这不是我想要的。还有其他方法吗?

首先找到屏幕大小

    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];
}