Skip to content

Instantly share code, notes, and snippets.

@objectiveSee
Created October 4, 2013 09:37
Show Gist options
  • Save objectiveSee/6823453 to your computer and use it in GitHub Desktop.
Save objectiveSee/6823453 to your computer and use it in GitHub Desktop.
@implementation UIDevice (EAAdditions)
+ (BOOL)isFourInch
{
static dispatch_once_t onceToken;
static BOOL itIs = NO;
dispatch_once(&onceToken, ^{
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if (screenBounds.size.height == 568) {
itIs = YES;
}
});
return itIs;
}
+ (BOOL)isSimulator {
#if (TARGET_IPHONE_SIMULATOR)
return YES;
#else
return NO;
#endif
}
+ (BOOL)isIOS7 {
return ( [[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 );
}
+ (BOOL)isRetina
{
return ([UIScreen mainScreen].scale >= 2.0);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment