Reputation: 1203
I would like to create a full screen application (mac) but eventhough I have the window fullscreen;
[window setFrame:[window frameRectForContentRect:[[window screen] frame]]display:YES animate:YES];
I can't get rid of the title bar? Can you change the above code to make the window without a titlebar or do you have to do it completely different? Thanks :)
Upvotes: 2
Views: 3624
Reputation: 959
I successfully placed the window over the titlebar using the window level NSScreenSaverWindowLevel
, instead of NSFloatingWindowLevel
suggested in Macmade's answer.
fullscreenWindow = [[NSWindow alloc]
initWithContentRect:[[NSScreen mainScreen] frame]
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:YES];
[fullscreenWindow setLevel:NSScreenSaverWindowLevel];
// Perform further configuration here, e.g. setTitle, setBackgroundColor etc.
[fullscreenWindow makeKeyAndOrderFront:nil];
Upvotes: 1
Reputation: 53970
CocoaWithLove has a good article about it:
http://cocoawithlove.com/2009/08/animating-window-to-fullscreen-on-mac.html
fullscreenWindow = [[FullscreenWindow alloc]
initWithContentRect:[mainWindow contentRectForFrameRect:[mainWindow frame]]
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:YES
screen:[mainWindow screen]];
[fullscreenWindow setLevel:NSFloatingWindowLevel];
[fullscreenWindow setContentView:[mainWindow contentView]];
[fullscreenWindow setTitle:[mainWindow title]];
[fullscreenWindow makeKeyAndOrderFront:nil];
Upvotes: 4