Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a Mac OSX Cocoa application fullscreen?

Tags:

I have been trying to make my Mac application enter fullscreen now for a while but can't get it to work. According to the Apple developer center, I should use enterFullScreenMode:withOptions: which gives me, method enterFullScreenMode not found.

Everywhere I google there seems to be people having issues with making their app fullscreen, so what is the way to make it work?

Edit:

Of course enterFullScreenMode is for the NSView and I used it on a NSWindow; it's not the view I want to have fullscreen, but the window. I can't find any function for the NSWindow though.

like image 855
tobros91 Avatar asked Feb 07 '11 13:02

tobros91


People also ask

How do I force an application to full screen on a Mac?

On your Mac, move the pointer to the green button in the top-left corner of the window, then choose Enter Full Screen from the menu that appears or click the button .

How do I resize an application window on a Mac?

Go to Window 2, move the cursor over the top-left corner, hold the Shift key and resize the window to match its left-side edge with the right-side edge of the Window 1. 3. Use Command + ` keyboard shortcut to switch to Window 1, hold the Option key and press the green dot to fit the window to the screen.

What is the Mac command for full screen?

To enter full screen in an app that supports it, press Control-Command-F. You can also navigate to the green full-screen button in the top-left corner of the app window, then press Command-Space bar. The full-screen button can also expand (or maximize) the window.


1 Answers

Lion has some new APIs for full screen.

To do it with NSWindow, do this

[window setCollectionBehavior:           NSWindowCollectionBehaviorFullScreenPrimary]; 

To do this with NSApplication do this

[[NSApplication sharedApplication]         setPresentationOptions:NSFullScreenWindowMask]; 

A bit more about it here.

like image 165
Randall Avatar answered Sep 25 '22 03:09

Randall