سؤال

I'm working on an OSX app that supports a fullscreen mode.

The window is generated from a nib file but everything else is handled programmatically.

When I goes in fullscreen mode, my views resize properly but when the menu bar appear/disappear, setFrame don't get called for either the contentView or my own views. I'd to be notified

Is there a delegate to implement to catch those notifications? Or do I have to subclass NSWindow and find out how Safari handles its menu bar by reversing it?

هل كانت مفيدة؟

المحلول 2

After some researches, I could at least get ride of the dirty gray bar at the top of the screen by subclassing the window's content view and add the following code to the setFrame method, before call super:

//isFullscreen
if(([self.window styleMask] & NSFullScreenWindowMask) == NSFullScreenWindowMask)
{
    frameRect.size.height = self.window.frame.size.height;
    frameRect.size.width = self.window.frame.size.width;
}

The window get resized to the screen size before setFrame get called, so we can use its size to update frameRect to window's size.

نصائح أخرى

It would be helpful to see some code, how exactly "your views resize properly".

But next info might help:

When a window goes fullscreen it occupies entire screen after the end of the fullscreen animation. The main menu bar shows over the window ("above" in sense of z-ordering). So when main menu bar shows/hides frame of your window and content view don't change. Also note, that -[NSScreen visibleFrame] returns unoccupied frame. And it will not return whole screen frame until the end of the fullscreen animation.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top