How to know if a NSWindow is fullscreen in Mac OS X Lion?

前端 未结 4 1244
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-04 05:14

I guess I should check if [NSApplication presentationOptions] contains NSFullScreenModeApplicationPresentationOptions, but how do I achieve that?

4条回答
  •  醉梦人生
    2021-01-04 05:56

    For Swift 3.0

    if let window = NSApp.mainWindow {
        let isWindowFullscreen = window.styleMask.contains(NSFullScreenWindowMask)
    }
    

    Obviously, for the original question, you'd replace NSApp.mainWindow with whichever document window you're wanting to check.

提交回复
热议问题