![](/img/trans.png)
[英]How to create a FullScreen NSWindow which should show the dock but hide menu bar?
[英]NSWindow Fullscreen, but show dock
現在我終於設法通過http://cocoadevcentral.com/articles/000028.php 出色的教程創建了全屏 window。 現在的問題是如何使用以下代碼顯示停靠欄和菜單欄,因為目前我有一個完全黑屏,我想看到一個菜單欄和一個停靠欄。 那可能嗎?
- (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]];
}
進行了一些實驗,但我想通了;
- (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]];
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.