Skip to content

Instantly share code, notes, and snippets.

@jlcampana
Created May 21, 2014 07:12
Show Gist options
  • Save jlcampana/834e4cd7b160d204e7de to your computer and use it in GitHub Desktop.
Save jlcampana/834e4cd7b160d204e7de to your computer and use it in GitHub Desktop.
Check IOS version (preprocessor macro)
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
//Example: SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.1") ? 0.0f : 0.5f;
//Example: SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment