Created
January 14, 2014 17:41
-
-
Save lluisgerard/8422427 to your computer and use it in GitHub Desktop.
iOS :: Know if a device is capable of doing iOS7 blur effect (using UIToolBar hack) Using: https://github.com/lmirosevic/GBDeviceInfo
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
+ (BOOL)allowsBlurEffect { | |
// I assume that any device that is not checked here is newer and therefore is "blur" capable | |
static BOOL isAllowed = YES; | |
static BOOL isChecked = NO; | |
if (!isChecked) { | |
isChecked = YES; | |
GBDeviceDetails *deviceDetails = [GBDeviceInfo deviceDetails]; | |
// iOS 7 at least | |
isAllowed = (deviceDetails.majoriOSVersion >= 7); | |
if (isAllowed) { | |
// If we have minimum iOS, now check the device | |
switch (deviceDetails.family) { | |
case GBDeviceFamilyiPhone: | |
// iPhone -- 4S at least | |
isAllowed = deviceDetails.majorModelNumber >= 4; | |
break; | |
case GBDeviceFamilyiPod: | |
// iPod --- 5 Gen at least | |
isAllowed = deviceDetails.majorModelNumber >= 5; | |
break; | |
case GBDeviceFamilyiPad: | |
// iPad ---- At least 4 | |
isAllowed = deviceDetails.majorModelNumber >= 4; | |
// Maybe is an iPad mini and it is allowed | |
if (!isAllowed) | |
isAllowed = deviceDetails.model == (GBDeviceModeliPadMini | GBDeviceModeliPadMiniRetina); | |
default: | |
break; | |
} | |
} | |
NSLog(@"Device %@ blur effect", isAllowed ? @"ALLOWS" : @"DON'T ALLOWS"); | |
} | |
return isAllowed; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use at your own risk, wrote this in just 2 minutes.