本文介绍了如何知道NSWindow是否是Mac OS X Lion中的全屏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我应该检查 [NSApplication presentationOptions] 是否包含 NSFullScreenModeApplicationPresentationOptions ,但是如何实现? / p>

编辑:使用 [NSApplication presentationOptions] 无法在我的基于文档的应用程序中,在全屏和其他人不。我现在正在寻找另一个解决方案。我想知道为什么没有属性 [NSWindow isFullscreen] 或类似的东西。

解决方案

我只是寻找一个解决方案自己和基于Matthieu的回答我创建了一个类别在NSWindow,对我来说很好。

  @interface NSWindow(FullScreen)

- (BOOL)mn_isFullScreen;

@end

@implementation NSWindow(FullScreen)

- (BOOL)mn_isFullScreen
{
return self styleMask]& NSFullScreenWindowMask)== NSFullScreenWindowMask);
}

@end


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

EDIT: using [NSApplication presentationOptions] doesn't work as in my document-based app there might be some documents in fullscreen and others not. I'm now looking for another solution. I'm wondering why there isn't a property called [NSWindow isFullscreen] or something like that.

解决方案

I was just looking for a solution myself and based on Matthieu's answer I created a category on NSWindow that works fine for me.

@interface NSWindow (FullScreen)

- (BOOL)mn_isFullScreen;

@end

@implementation NSWindow (FullScreen)

- (BOOL)mn_isFullScreen
{
    return (([self styleMask] & NSFullScreenWindowMask) == NSFullScreenWindowMask);
}

@end

这篇关于如何知道NSWindow是否是Mac OS X Lion中的全屏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 21:12