How to check if it works on Lion or Snow Leopard

In my Cocoa app, I want the user to take the app full screen on Lion. For this, I would like to add the following:

if (check for lion or above) { [mywindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; } 

I add this conditionally for Lion, because NSWindowCollectionBehaviorFullScreenPrimary is only available with 10.7. What is the best way to test a lion or higher?

+6
source share
1 answer

You should read the documentation on the Gestalt feature.

 SInt32 MacVersion; if( Gestalt( gestaltSystemVersion, &MacVersion ) == noErr ) { if( MacVersion == 0x1050 ) /* Mac OS X 10.5.0 */ {} else {} } 

Or you can use the SysCTL API

+7
source

Source: https://habr.com/ru/post/895151/


All Articles