How to make a Mac OSX Cocoa application fullscreen?

后端 未结 4 1779
失恋的感觉
失恋的感觉 2021-02-01 19:11

I have been trying to make my Mac application enter fullscreen now for a while but can\'t get it to work. According to the Apple developer center, I should use enterFullScreenMo

4条回答
  •  旧巷少年郎
    2021-02-01 19:37

    Lion has some new APIs for full screen.

    To do it with NSWindow, do this

    [window setCollectionBehavior:
              NSWindowCollectionBehaviorFullScreenPrimary];
    

    To do this with NSApplication do this

    [[NSApplication sharedApplication]
            setPresentationOptions:NSFullScreenWindowMask];
    

    A bit more about it here.

提交回复
热议问题