Skip to content

Instantly share code, notes, and snippets.

@Adnan1990
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save Adnan1990/9641327 to your computer and use it in GitHub Desktop.

Select an option

Save Adnan1990/9641327 to your computer and use it in GitHub Desktop.
IOS version
/*
* 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)
/*
* Font Family with Size Macro
*/
#define FONT_Bebas_STD(s) [UIFont fontWithName:@"Bebas" size:s]
/*
* Usage
*/
myLabel.font =FONT_Bebas_STD(70.0f);//[UIFont fontWithName:@"Bebas" size:80.0];
if (SYSTEM_VERSION_LESS_THAN(@"7.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