Cocoa - dual full screen mode?
I'm开发者_Go百科 an ObjC / Cocoa novice.
I have a WebView
which I wish to display full screen across two screens side-by-side.
Using NSView enterFullScreenMode
with the NSFullScreenModeAllScreens
option I can make my app go full screen, but the WebView
only fills my left-hand primary display - the secondary (right hand) display stays black.
Is it possible to make the WebView
fill both screens?
I found the answer myself:
NSDictionary *opts = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSFullScreenModeAllScreens,
nil];
NSView *view = [window contentView];
[view enterFullScreenMode:[NSScreen mainScreen] withOptions:opts];
NSRect frame = [view.window frame];
frame.size.width *= 2;
[view.window setContentSize:frame.size];
The last line is the important one - it's necessary to set the size of view.window
rather than the window
property of the application delegate. For reasons I don't yet understand those don't appear to be the same thing.
精彩评论