Created
June 21, 2012 00:03
-
-
Save cbowns/2963045 to your computer and use it in GitHub Desktop.
UIDevice System Version Preprocessor Macros
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
System Versioning Preprocessor Macros via http://stackoverflow.com/questions/3339722/check-iphone-ios-version | |
Example: | |
if (UIDeviceSystemVersionLessThan(@"4.0")) { | |
// code for pre-4.0 devices. | |
} | |
if (UIDeviceSystemVersionGreaterThanOrEqualTo(@"3.1.1")) { | |
// Code for 3.1.1. | |
} | |
*/ | |
#define UIDeviceSystemVersionEqualTo(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame) | |
#define UIDeviceSystemVersionGreaterThan(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending) | |
#define UIDeviceSystemVersionGreaterThanOrEqualTo(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) | |
#define UIDeviceSystemVersionLessThan(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) | |
#define UIDeviceSystemVersionLessThanOrEqualTo(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment