Created
November 12, 2012 11:48
-
-
Save newmarcel/4058921 to your computer and use it in GitHub Desktop.
iPad Mini First Generation Detection (Needs actual device testing!)
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
#import <UIKit/UIKit.h> | |
@interface UIDevice (iPadMini) | |
@property (nonatomic, readonly, getter = isMiniModel) BOOL miniModel; | |
@end |
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
#import "UIDevice_iPadMini.h" | |
#include <sys/utsname.h> | |
@implementation UIDevice (iPadMini) | |
- (BOOL)isMiniModel | |
{ | |
struct utsname deviceData; | |
uname(&deviceData); | |
NSString * machine = [NSString stringWithCString:deviceData.machine encoding:NSUTF8StringEncoding]; | |
NSArray * iPadMiniFirstGenDeviceIdentifiers = @[ | |
@"iPad2,5", // WiFi | |
@"iPad2,6", // GSM | |
@"iPad2,7", // CDMA | |
]; | |
NSArray * results = [iPadMiniFirstGenDeviceIdentifiers filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF == %@", machine]]; | |
if( [results count] > 0 ) | |
return YES; | |
else | |
return NO; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment