Last active
August 29, 2015 13:57
-
-
Save pyanfield/9460976 to your computer and use it in GitHub Desktop.
compare the current ios version with special one.
This file contains hidden or 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
// information comes from http://stackoverflow.com/questions/3339722/how-to-check-ios-version | |
//------------------------------------- | |
// you can use this in your code | |
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) { | |
// Load resources for iOS 6.1 or earlier | |
} else { | |
// Load resources for iOS 7 or later | |
} | |
//------------------------------------- | |
/* | |
* System Versioning Preprocessor Macros | |
*/ | |
#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) | |
/* | |
* Usage | |
*/ | |
if (SYSTEM_VERSION_LESS_THAN(@"4.0")) { | |
... | |
} | |
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"3.1.1")) { | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment