From f7766ec786149a37e7e8e23b91e08d54919b6084 Mon Sep 17 00:00:00 2001 From: Ian G Date: Tue, 28 Aug 2012 16:39:34 -0700 Subject: [PATCH 01/17] warning fix --- UIDevice-Capabilities.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UIDevice-Capabilities.m b/UIDevice-Capabilities.m index 5b323ab..6c68490 100644 --- a/UIDevice-Capabilities.m +++ b/UIDevice-Capabilities.m @@ -23,7 +23,7 @@ - (BOOL) supportsCapability: (NSString *) capability void *libHandle = dlopen(GRAPHICS_SERVICES_PATH, RTLD_LAZY); int (*GSSystemHasCapability)(NSString *); GSSystemHasCapability = dlsym(libHandle, "GSSystemHasCapability"); - BOOL result = GSSystemHasCapability(capability); + BOOL result = ( BOOL )GSSystemHasCapability(capability); dlclose(libHandle); return result; } From 7bbb4414da99b2725a0a2dbca94027d1ba154d9c Mon Sep 17 00:00:00 2001 From: Ian G Date: Tue, 28 Aug 2012 17:31:28 -0700 Subject: [PATCH 02/17] gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index adce207..f82a0f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *.xcodeproj/* !*.xcodeproj/project.pbxproj /build + +/.DS_Store \ No newline at end of file From 6a830fe6156726a63e814a1982f268b9887317cc Mon Sep 17 00:00:00 2001 From: Ian G Date: Tue, 28 Aug 2012 17:31:41 -0700 Subject: [PATCH 03/17] warnings --- Apple Sample Code/wwanconnect.c | 2 +- UIDevice-Orientation.m | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Apple Sample Code/wwanconnect.c b/Apple Sample Code/wwanconnect.c index 1d03572..871d557 100644 --- a/Apple Sample Code/wwanconnect.c +++ b/Apple Sample Code/wwanconnect.c @@ -116,7 +116,7 @@ extern MyInfoRef StartWWAN(ConnectClientCallBack clientCB, void *refCon) CFStreamClientContext ctxt = {0, NULL, NULL, NULL, NULL}; Boolean errorOccurred = FALSE; - myInfoPtr = malloc(sizeof(MyStreamInfo)); + myInfoPtr = ( MyStreamInfoPtr )malloc(sizeof(MyStreamInfo)); if (!myInfoPtr) { return NULL; diff --git a/UIDevice-Orientation.m b/UIDevice-Orientation.m index 77296ef..68e2cc3 100644 --- a/UIDevice-Orientation.m +++ b/UIDevice-Orientation.m @@ -14,8 +14,8 @@ @implementation UIDevice (Orientation) - (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration { - CGFloat xx = acceleration.x; - CGFloat yy = -acceleration.y; + double xx = acceleration.x; + double yy = -acceleration.y; device_angle = M_PI / 2.0f - atan2(yy, xx); if (device_angle > M_PI) From 1c566af1c3e43d292442ba74e7992ba9c149910d Mon Sep 17 00:00:00 2001 From: Ian G Date: Wed, 29 Aug 2012 00:56:59 -0700 Subject: [PATCH 04/17] fix --- UIDevice-Reachability.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UIDevice-Reachability.m b/UIDevice-Reachability.m index 7b9db8c..fdfdd33 100644 --- a/UIDevice-Reachability.m +++ b/UIDevice-Reachability.m @@ -74,7 +74,7 @@ + (NSString *) portFromData:(NSData *) addressData if (addressData != nil) { struct sockaddr_in addrIn = *(struct sockaddr_in *)[addressData bytes]; - port = [NSString stringWithFormat: @"%s", ntohs(addrIn.sin_port)]; + port = [NSString stringWithFormat: @"%us", ntohs(addrIn.sin_port)]; } return port; From 03aee3ccabe0c4b944e570f25168890927eca123 Mon Sep 17 00:00:00 2001 From: Ian G Date: Thu, 30 Aug 2012 13:54:37 -0700 Subject: [PATCH 05/17] parse port from host --- UIDevice-Reachability.m | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/UIDevice-Reachability.m b/UIDevice-Reachability.m index fdfdd33..cfef5ea 100644 --- a/UIDevice-Reachability.m +++ b/UIDevice-Reachability.m @@ -185,8 +185,22 @@ - (NSString *) whatismyipdotcom - (BOOL) hostAvailable: (NSString *) theHost { - - NSString *addressString = [self getIPAddressForHost:theHost]; + NSArray *hostComponents = [theHost componentsSeparatedByString:@":"]; + NSString *hostName; + NSString *port; + if ( [ hostComponents count ] > 0 ) + { + hostName = [ hostComponents objectAtIndex:0 ]; + if ( [ hostComponents count ] > 1 ) + { + port = [ hostComponents objectAtIndex:1 ]; + } + } else + { + hostName = theHost; + } + + NSString *addressString = [self getIPAddressForHost:hostName]; if (!addressString) { printf("Error recovering IP address from host name\n"); From ab71ed3fb201fc67a2e85f5cf8df554bd5ee3ff9 Mon Sep 17 00:00:00 2001 From: Ian G Date: Sun, 2 Sep 2012 02:23:26 -0700 Subject: [PATCH 06/17] removes warnings in non arc builds --- UIDevice-Reachability.m | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/UIDevice-Reachability.m b/UIDevice-Reachability.m index cfef5ea..72ea046 100644 --- a/UIDevice-Reachability.m +++ b/UIDevice-Reachability.m @@ -328,7 +328,12 @@ - (void) shutdownWWAN static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkConnectionFlags flags, void* info) { @autoreleasepool { - id watcher = (__bridge id) info; + id watcher; +#if __has_feature(objc_arc) + watcher = (__bridge id) info; +#else + watcher = (id) info; +#endif if ([watcher respondsToSelector:@selector(reachabilityChanged)]) [watcher performSelector:@selector(reachabilityChanged)]; } @@ -344,8 +349,12 @@ - (BOOL) scheduleReachabilityWatcher: (id) watcher [self pingReachabilityInternal]; - SCNetworkReachabilityContext context = {0, (__bridge void *)watcher, NULL, NULL, NULL}; - if(SCNetworkReachabilitySetCallback(reachability, ReachabilityCallback, &context)) +#if __has_feature(objc_arc) + SCNetworkReachabilityContext context = {0, (__bridge void *)watcher, NULL, NULL, NULL}; +#else + SCNetworkReachabilityContext context = {0, watcher, NULL, NULL, NULL}; +#endif + if(SCNetworkReachabilitySetCallback(reachability, ReachabilityCallback, &context)) { if(!SCNetworkReachabilityScheduleWithRunLoop(reachability, CFRunLoopGetCurrent(), kCFRunLoopCommonModes)) { From e9246502deaaaa209047f0f3f09542204d174020 Mon Sep 17 00:00:00 2001 From: Ian G Date: Mon, 3 Sep 2012 09:54:55 -0700 Subject: [PATCH 07/17] handles casting warnings --- UIDevice-Orientation.m | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/UIDevice-Orientation.m b/UIDevice-Orientation.m index 68e2cc3..0d63212 100644 --- a/UIDevice-Orientation.m +++ b/UIDevice-Orientation.m @@ -9,6 +9,12 @@ #import "UIDevice-Orientation.h" @implementation UIDevice (Orientation) +const CGFloat to_angle_upside_down = ( CGFloat )M_PI; +const CGFloat to_angle_landscape_left = ( CGFloat )-( M_PI/2.0f ); +const CGFloat to_angle_landscape_right = ( CGFloat )( M_PI/2.0f ); + +const CGFloat from_angle = ( CGFloat )( M_PI * 2.0f ); + #pragma mark current angle CGFloat device_angle; @@ -16,7 +22,7 @@ - (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAccelera { double xx = acceleration.x; double yy = -acceleration.y; - device_angle = M_PI / 2.0f - atan2(yy, xx); + device_angle = ( CGFloat )( M_PI / 2.0f - atan2(yy, xx) ); if (device_angle > M_PI) device_angle -= 2 * M_PI; @@ -32,11 +38,11 @@ - (CGFloat) orientationAngle case UIDeviceOrientationPortrait: return 0.0f; case UIDeviceOrientationPortraitUpsideDown: - return M_PI; + return to_angle_upside_down; case UIDeviceOrientationLandscapeLeft: - return -(M_PI/2.0f); + return to_angle_landscape_left; case UIDeviceOrientationLandscapeRight: - return (M_PI/2.0f); + return to_angle_landscape_right; default: return 0.0f; } @@ -76,15 +82,15 @@ - (CGFloat) orientationAngleRelativeToOrientation:(UIDeviceOrientation) someOrie CGFloat dOrientation = 0.0f; switch (someOrientation) { - case UIDeviceOrientationPortraitUpsideDown: {dOrientation = M_PI; break;} - case UIDeviceOrientationLandscapeLeft: {dOrientation = -(M_PI/2.0f); break;} - case UIDeviceOrientationLandscapeRight: {dOrientation = (M_PI/2.0f); break;} + case UIDeviceOrientationPortraitUpsideDown: {dOrientation = to_angle_upside_down; break;} + case UIDeviceOrientationLandscapeLeft: {dOrientation = to_angle_landscape_left; break;} + case UIDeviceOrientationLandscapeRight: {dOrientation = to_angle_landscape_right; break;} default: break; } - CGFloat adjustedAngle = fmod(self.orientationAngle - dOrientation, 2.0f * M_PI); + CGFloat adjustedAngle = fmodf(self.orientationAngle - dOrientation, from_angle ); if (adjustedAngle > (M_PI + 0.01f)) - adjustedAngle = (adjustedAngle - 2.0f * M_PI); + adjustedAngle = ( adjustedAngle - from_angle ); return adjustedAngle; } From 6848442a7a4531e2514a719b9c3f64e4ad5ec5a5 Mon Sep 17 00:00:00 2001 From: Ian G Date: Wed, 10 Oct 2012 23:37:45 -0700 Subject: [PATCH 08/17] make static, image suffix for retina display --- UIDevice-Hardware.h | 3 ++- UIDevice-Hardware.m | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/UIDevice-Hardware.h b/UIDevice-Hardware.h index 261229b..4fbd92b 100644 --- a/UIDevice-Hardware.h +++ b/UIDevice-Hardware.h @@ -103,6 +103,7 @@ typedef enum { - (NSString *) macaddress; -- (BOOL) hasRetinaDisplay; ++ (BOOL) hasRetinaDisplay; ++ (NSString *) imageSuffixRetinaDisplay; - (UIDeviceFamily) deviceFamily; @end \ No newline at end of file diff --git a/UIDevice-Hardware.m b/UIDevice-Hardware.m index 07c033f..e983317 100644 --- a/UIDevice-Hardware.m +++ b/UIDevice-Hardware.m @@ -233,11 +233,16 @@ - (NSString *) platformString } } -- (BOOL) hasRetinaDisplay ++ (BOOL) hasRetinaDisplay { return ([UIScreen mainScreen].scale == 2.0f); } ++ (NSString *) imageSuffixRetinaDisplay +{ + return @"@2x"; +} + - (UIDeviceFamily) deviceFamily { NSString *platform = [self platform]; From 2b131be699ed25dcfccb69526520cfbdedaadcd7 Mon Sep 17 00:00:00 2001 From: Ian G Date: Wed, 10 Oct 2012 23:37:54 -0700 Subject: [PATCH 09/17] 4 inch display support --- UIDevice-Hardware.h | 3 +++ UIDevice-Hardware.m | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/UIDevice-Hardware.h b/UIDevice-Hardware.h index 4fbd92b..c423606 100644 --- a/UIDevice-Hardware.h +++ b/UIDevice-Hardware.h @@ -105,5 +105,8 @@ typedef enum { + (BOOL) hasRetinaDisplay; + (NSString *) imageSuffixRetinaDisplay; ++ (BOOL) has4InchDisplay; ++ (NSString *) imageSuffix4InchDisplay; + - (UIDeviceFamily) deviceFamily; @end \ No newline at end of file diff --git a/UIDevice-Hardware.m b/UIDevice-Hardware.m index e983317..ca7beec 100644 --- a/UIDevice-Hardware.m +++ b/UIDevice-Hardware.m @@ -243,6 +243,16 @@ + (NSString *) imageSuffixRetinaDisplay return @"@2x"; } ++ (BOOL) has4InchDisplay +{ + return ([UIScreen mainScreen].bounds.size.height == 568); +} + ++ (NSString *) imageSuffix4InchDisplay +{ + return @"-568h"; +} + - (UIDeviceFamily) deviceFamily { NSString *platform = [self platform]; From caf74cacb3ab84cc9a8adc50d475098df3cb35eb Mon Sep 17 00:00:00 2001 From: Ian G Date: Tue, 13 Nov 2012 11:19:36 -0800 Subject: [PATCH 10/17] Merge branch 'master' of https://github.com/Cykey/uidevice-extension --- UIDevice-Reachability.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UIDevice-Reachability.m b/UIDevice-Reachability.m index 72ea046..3c8283a 100644 --- a/UIDevice-Reachability.m +++ b/UIDevice-Reachability.m @@ -178,7 +178,7 @@ + (NSArray *) localWiFiIPAddresses - (NSString *) whatismyipdotcom { NSError *error; - NSURL *ipURL = [NSURL URLWithString:@"http://www.whatismyip.com/automation/n09230945.asp"]; + NSURL *ipURL = [NSURL URLWithString:@"http://automation.whatismyip.com/n09230945.asp"]; NSString *ip = [NSString stringWithContentsOfURL:ipURL encoding:1 error:&error]; return ip ? ip : [error localizedDescription]; } From 5d2996c21967a5342edeed9fb89f0eb05ef503be Mon Sep 17 00:00:00 2001 From: Ian G Date: Wed, 14 Nov 2012 17:11:34 -0800 Subject: [PATCH 11/17] iPad 4 models --- UIDevice-Hardware.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/UIDevice-Hardware.m b/UIDevice-Hardware.m index ca7beec..5afdd7f 100644 --- a/UIDevice-Hardware.m +++ b/UIDevice-Hardware.m @@ -171,7 +171,19 @@ - (NSUInteger) platformType // iPad if ([platform hasPrefix:@"iPad1"]) return UIDevice1GiPad; if ([platform hasPrefix:@"iPad2"]) return UIDevice2GiPad; - if ([platform hasPrefix:@"iPad3"]) return UIDevice3GiPad; + if ([platform hasPrefix:@"iPad3"]) + { + NSString* prefix = @"iPad3"; + NSString* suffix = [platform substringFromIndex:[prefix length] + 1]; // + 1 for ',' + NSInteger submodel = [ suffix intValue ]; + if ( submodel <= 3 ) + { + return UIDevice3GiPad; + } else + { + return UIDevice4GiPad; + } + } if ([platform hasPrefix:@"iPad4"]) return UIDevice4GiPad; // Apple TV From a8408ff532276f9cebe3c483514b00a12cb52250 Mon Sep 17 00:00:00 2001 From: Ian G Date: Wed, 14 Nov 2012 17:41:38 -0800 Subject: [PATCH 12/17] text fix --- UIDevice-Hardware.m | 1 + 1 file changed, 1 insertion(+) diff --git a/UIDevice-Hardware.m b/UIDevice-Hardware.m index 5afdd7f..6d09075 100644 --- a/UIDevice-Hardware.m +++ b/UIDevice-Hardware.m @@ -46,6 +46,7 @@ @implementation UIDevice (Hardware) iPad3,1 -> (iPad 3G, WiFi) iPad3,2 -> (iPad 3G, GSM) iPad3,3 -> (iPad 3G, CDMA) + iPad3,4 -> (iPad 4G, WiFi) iPad4,1 -> (iPad 4G, WiFi) iPad4,2 -> (iPad 4G, GSM) iPad4,3 -> (iPad 4G, CDMA) From 2363a27cca47ea4e8b3d9a0a1c82161712b938d1 Mon Sep 17 00:00:00 2001 From: Ian G Date: Tue, 20 Nov 2012 13:46:34 -0800 Subject: [PATCH 13/17] iPad Mini detection --- UIDevice-Hardware.h | 4 ++++ UIDevice-Hardware.m | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/UIDevice-Hardware.h b/UIDevice-Hardware.h index c423606..015122c 100644 --- a/UIDevice-Hardware.h +++ b/UIDevice-Hardware.h @@ -28,6 +28,8 @@ #define IPAD_4G_NAMESTRING @"iPad 4G" #define IPAD_UNKNOWN_NAMESTRING @"Unknown iPad" +#define IPAD_MINI_NAMESTRING @"iPad Mini" + #define APPLETV_2G_NAMESTRING @"Apple TV 2G" #define APPLETV_3G_NAMESTRING @"Apple TV 3G" #define APPLETV_4G_NAMESTRING @"Apple TV 4G" @@ -65,6 +67,8 @@ typedef enum { UIDevice3GiPad, UIDevice4GiPad, + UIDeviceiPadMini, + UIDeviceAppleTV2, UIDeviceAppleTV3, UIDeviceAppleTV4, diff --git a/UIDevice-Hardware.m b/UIDevice-Hardware.m index 6d09075..58ec80e 100644 --- a/UIDevice-Hardware.m +++ b/UIDevice-Hardware.m @@ -50,6 +50,8 @@ @implementation UIDevice (Hardware) iPad4,1 -> (iPad 4G, WiFi) iPad4,2 -> (iPad 4G, GSM) iPad4,3 -> (iPad 4G, CDMA) + + iPad2,5 -> (iPad Mini, Wifi) AppleTV2,1 -> AppleTV 2, K66 AppleTV3,1 -> AppleTV 3, ?? @@ -171,7 +173,19 @@ - (NSUInteger) platformType // iPad if ([platform hasPrefix:@"iPad1"]) return UIDevice1GiPad; - if ([platform hasPrefix:@"iPad2"]) return UIDevice2GiPad; + if ([platform hasPrefix:@"iPad2"]) + { + NSString* prefix = @"iPad2"; + NSString* suffix = [platform substringFromIndex:[prefix length] + 1]; // + 1 for ',' + NSInteger submodel = [ suffix intValue ]; + if ( submodel <= 4 ) + { + return UIDevice2GiPad; + } else + { + return UIDeviceiPadMini; + } + } if ([platform hasPrefix:@"iPad3"]) { NSString* prefix = @"iPad3"; @@ -230,6 +244,8 @@ - (NSString *) platformString case UIDevice4GiPad : return IPAD_4G_NAMESTRING; case UIDeviceUnknowniPad : return IPAD_UNKNOWN_NAMESTRING; + case UIDeviceiPadMini : return IPAD_MINI_NAMESTRING; + case UIDeviceAppleTV2 : return APPLETV_2G_NAMESTRING; case UIDeviceAppleTV3 : return APPLETV_3G_NAMESTRING; case UIDeviceAppleTV4 : return APPLETV_4G_NAMESTRING; From ee62f055427c5524aa5880b36c2b445b3ed097cf Mon Sep 17 00:00:00 2001 From: Ian G Date: Tue, 20 Nov 2012 14:07:05 -0800 Subject: [PATCH 14/17] refactoring --- UIDevice-Hardware.m | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/UIDevice-Hardware.m b/UIDevice-Hardware.m index 58ec80e..f66580f 100644 --- a/UIDevice-Hardware.m +++ b/UIDevice-Hardware.m @@ -149,6 +149,18 @@ - (NSNumber *) freeDiskSpace return [fattributes objectForKey:NSFileSystemFreeSize]; } ++( NSInteger )getSubmodel:( NSString* )platform +{ + NSInteger submodel = -1; + + NSArray* components = [ platform componentsSeparatedByString:@"," ]; + if ( [ components count ] >= 2 ) + { + submodel = [ [ components objectAtIndex:1 ] intValue ]; + } + return submodel; +} + #pragma mark platform type and name utils - (NSUInteger) platformType { @@ -175,9 +187,7 @@ - (NSUInteger) platformType if ([platform hasPrefix:@"iPad1"]) return UIDevice1GiPad; if ([platform hasPrefix:@"iPad2"]) { - NSString* prefix = @"iPad2"; - NSString* suffix = [platform substringFromIndex:[prefix length] + 1]; // + 1 for ',' - NSInteger submodel = [ suffix intValue ]; + NSInteger submodel = [ UIDevice getSubmodel:platform ]; if ( submodel <= 4 ) { return UIDevice2GiPad; @@ -188,9 +198,7 @@ - (NSUInteger) platformType } if ([platform hasPrefix:@"iPad3"]) { - NSString* prefix = @"iPad3"; - NSString* suffix = [platform substringFromIndex:[prefix length] + 1]; // + 1 for ',' - NSInteger submodel = [ suffix intValue ]; + NSInteger submodel = [ UIDevice getSubmodel:platform ]; if ( submodel <= 3 ) { return UIDevice3GiPad; From 6b34f8cb090be2802f5896411513582b846d6a26 Mon Sep 17 00:00:00 2001 From: Ian G Date: Sun, 31 Mar 2013 09:51:44 -0700 Subject: [PATCH 15/17] more in line with the rest of the library --- UIDevice-Hardware.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UIDevice-Hardware.h b/UIDevice-Hardware.h index 015122c..78ba48a 100644 --- a/UIDevice-Hardware.h +++ b/UIDevice-Hardware.h @@ -107,10 +107,10 @@ typedef enum { - (NSString *) macaddress; -+ (BOOL) hasRetinaDisplay; -+ (NSString *) imageSuffixRetinaDisplay; -+ (BOOL) has4InchDisplay; -+ (NSString *) imageSuffix4InchDisplay; +- (BOOL) hasRetinaDisplay; +- (NSString *) imageSuffixRetinaDisplay; +- (BOOL) has4InchDisplay; +- (NSString *) imageSuffix4InchDisplay; - (UIDeviceFamily) deviceFamily; @end \ No newline at end of file From f9831329fb7f25a3d013e8ea0191d12da29a7a39 Mon Sep 17 00:00:00 2001 From: Ian G Date: Sun, 31 Mar 2013 10:01:49 -0700 Subject: [PATCH 16/17] whoops, missed in commit --- UIDevice-Hardware.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UIDevice-Hardware.m b/UIDevice-Hardware.m index f66580f..620d560 100644 --- a/UIDevice-Hardware.m +++ b/UIDevice-Hardware.m @@ -270,22 +270,22 @@ - (NSString *) platformString } } -+ (BOOL) hasRetinaDisplay +- (BOOL) hasRetinaDisplay { return ([UIScreen mainScreen].scale == 2.0f); } -+ (NSString *) imageSuffixRetinaDisplay +- (NSString *) imageSuffixRetinaDisplay { return @"@2x"; } -+ (BOOL) has4InchDisplay +- (BOOL) has4InchDisplay { return ([UIScreen mainScreen].bounds.size.height == 568); } -+ (NSString *) imageSuffix4InchDisplay +- (NSString *) imageSuffix4InchDisplay { return @"-568h"; } From 16aaa70fb04d5e05827f9ab10df51ab67f605369 Mon Sep 17 00:00:00 2001 From: Ian G Date: Sun, 7 Apr 2013 19:38:03 -0700 Subject: [PATCH 17/17] Camera Field of View --- UIDevice-Hardware.h | 3 +++ UIDevice-Hardware.m | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/UIDevice-Hardware.h b/UIDevice-Hardware.h index 78ba48a..4c3c4f9 100644 --- a/UIDevice-Hardware.h +++ b/UIDevice-Hardware.h @@ -113,4 +113,7 @@ typedef enum { - (NSString *) imageSuffix4InchDisplay; - (UIDeviceFamily) deviceFamily; + +- (float) cameraFieldOfView; + @end \ No newline at end of file diff --git a/UIDevice-Hardware.m b/UIDevice-Hardware.m index 620d560..92606e8 100644 --- a/UIDevice-Hardware.m +++ b/UIDevice-Hardware.m @@ -360,4 +360,12 @@ - (NSString *) macaddress printf("Bluetooth %s enabled\n", bluetooth ? "is" : "isn't"); } */ + +- (float) cameraFieldOfView +{ + // TODO: fill out and test for all iDevice models + // http://www.caramba-apps.com/blog/files/field-of-view-angles-ipad-iphone.html + return 58.498f; +} + @end \ No newline at end of file