NSWindow Полноэкранный, но показывает док - PullRequest
1 голос
/ 27 мая 2011

Теперь мне наконец-то удалось создать полноэкранное окно с помощью http://cocoadevcentral.com/articles/000028.php Блестящий учебник. Теперь вопрос, как мне использовать следующий код, чтобы показать док-станцию ​​и меню, так как в настоящее время у меня полностью черный экран, я хотел бы видеть меню и док-станцию. Это возможно?

- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
     int windowLevel;
     NSRect screenRect;
     // Capture the main display
     if (CGDisplayCapture( kCGDirectMainDisplay ) != kCGErrorSuccess) {
         NSLog( @"Couldn't capture the main display!" );
         // Note: you'll probably want to display a proper error dialog here
     }
     // Get the shielding window level
     windowLevel = CGShieldingWindowLevel();
     // Get the screen rect of our main display
     screenRect = [[NSScreen mainScreen] frame];
     // Put up a new window
     mainWindow = [[NSWindow alloc] initWithContentRect:screenRect
                                    styleMask:NSBorderlessWindowMask
                                    backing:NSBackingStoreBuffered
                                    defer:NO screen:[NSScreen mainScreen]];
     [mainWindow setLevel:windowLevel];
     [mainWindow setBackgroundColor:[NSColor blackColor]];
     [mainWindow makeKeyAndOrderFront:nil];
     // Load our content view
     [slideShowPanel setFrame:screenRect display:YES];
     [mainWindow setContentView:[slideShowPanel contentView]];
}

1 Ответ

1 голос
/ 27 мая 2011

Немного поэкспериментировал, но я понял;

- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
int windowLevel;
NSRect screenRect;
// Capture the main display

// Get the screen rect of our main display
screenRect = [[NSScreen mainScreen] frame];
// Put up a new window
mainWindow = [[NSWindow alloc] initWithContentRect:screenRect
                                         styleMask:NSBorderlessWindowMask
                                           backing:NSBackingStoreBuffered
                                             defer:NO screen:[NSScreen mainScreen]];
[mainWindow setLevel:windowLevel];
[mainWindow setBackgroundColor:[NSColor blackColor]];
[mainWindow makeKeyAndOrderFront:nil];
// Load our content view
[slideShowPanel setFrame:screenRect display:YES];
[mainWindow setContentView:[slideShowPanel contentView]];

}
...