Skip to content

Instantly share code, notes, and snippets.

@rtsuk
Created April 28, 2013 02:27
Show Gist options
  • Save rtsuk/5475613 to your computer and use it in GitHub Desktop.
Save rtsuk/5475613 to your computer and use it in GitHub Desktop.
Here's how I do full screen. My windows are fixed size so you'll probably want to restore the window size as well.
-(IBAction)toggleFullScreen:(id)sender
{
NSWindow* myWindow = self.window;
self.fullScreen = !self.fullScreen;
if (self.fullScreen) {
_normalWindowMask = [myWindow styleMask];
_normalWindowLevel = [myWindow level];
NSRect mainDisplayRect = [[NSScreen mainScreen] frame];
[myWindow setStyleMask: NSBorderlessWindowMask];
[myWindow setLevel: NSMainMenuWindowLevel + 1];
[myWindow setFrame: mainDisplayRect display: YES animate: NO];
[myWindow setOpaque: YES];
} else {
[myWindow setStyleMask: _normalWindowMask];
[myWindow setLevel: _normalWindowLevel];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment