Skip to content
Browse files

added clcg_is_iphone5() function to detect if we're running on an iPh…

…one5
  • Loading branch information...
1 parent a618ff3 commit 166c1d988c028c052207d83176bb7112465e801f @ettore committed Nov 21, 2012
Showing with 20 additions and 10 deletions.
  1. +13 −10 clcg_device_utils.h
  2. +7 −0 clcg_device_utils.m
View
23 clcg_device_utils.h
@@ -42,27 +42,30 @@ extern "C" {
/** Saves a boolean pref value to user defaults. */
void clcg_savepref_bool(NSString *key, BOOL value);
- /** Gets a boolean pref value from the user defaults. */
+ /** @return A boolean pref value from the user defaults. */
BOOL clcg_getpref_bool(NSString *key);
- /** Gets a string pref value from the user defaults. */
+ /** @return A string pref value from the user defaults. */
NSString *clcg_getpref_str(NSString *key);
- /** Returns a string with the resolution (in pixel) and the scale value. */
+ /** @return A string with the resolution (in pixel) and the scale value. */
NSString *clcg_device_resolution(void);
- /** Returns YES if the device has camera capability. */
+ /** @return YES if the device has camera capability. */
BOOL clcg_has_camera(void);
- /** Returns YES if the device has a Retina display. */
+ /** @return YES if the device has a Retina display. */
BOOL clcg_has_retina(void);
- /** Returns YES if the device is an iPad. */
+ /** @return YES if the device is an iPad. */
BOOL clcg_is_ipad(void);
-
- /**
- * Returns YES if the OS version is >= than given version. The version string
- * can be something like "4.3.2".
+
+ /** @return YES if the device is an iPhone5 or other tall non-tablet device. */
+ BOOL clcg_is_iphone5(void);
+
+ /**
+ * @return YES if the OS version is >= than given version. The version string
+ * can be something like "4.3.2".
*/
BOOL clcg_os_geq(NSString* version);
View
7 clcg_device_utils.m
@@ -41,6 +41,13 @@ BOOL clcg_os_geq(NSString* version)
}
+BOOL clcg_is_iphone5(void)
+{
+ CGSize sz = [[UIScreen mainScreen] bounds].size;
+ return (!clcg_is_ipad() && sz.height > 480.0f);
+}
+
+
BOOL clcg_is_ipad(void)
{
if (clcg_os_geq(@"3.2"))

0 comments on commit 166c1d9

Please sign in to comment.
Something went wrong with that request. Please try again.