Tuesday, December 11, 2007

Today I Learned... Fullscreen mode made easy

I'm gonna start posting little things I learn each day (yeah - like it will actually happen each day...) Perhaps they will be of use to others. Leslie has already done this a few times and it seems like a great way of sharing little tidbits on the intarwebs.

Today's tidbit:
- (BOOL)enterFullScreenMode:(NSScreen *)screen withOptions:(NSDictionary *)options
- (void)exitFullScreenModeWithOptions:(NSDictionary *)options

These two little nuggets of joy from the Cocoa NSView class are incredibly useful when building an app that you want take over the whole screen when it is running (like a certain application I'm working on...) It's one thing that it goes full screen, but it is even cooler that it is for any NSView, not a full window so my custom view that hosts CALayer stuff can take over the whole screen during shows and hide all of the other config stuff around it.


Thanks to David for pointing this out.

Edit: Oh, and you need to be very careful with this API. Make sure you have a way to call exitFullScreenModeWithOptions, or activity monitor on a second monitor or you will have a perfectly functioning, yet completely unfunctional computer on your hands :) SSH'ing in from another machine and killing your process is a good back door if you get stuck here :)

No comments: