Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add clcg_is_iphone function

  • Loading branch information...
commit 298978b9627aea5f84dca3cc1d834ecd038579f2 1 parent 8f1e097
@ettore authored
Showing with 19 additions and 9 deletions.
  1. +4 −1 clcg_device_utils.h
  2. +15 −8 clcg_device_utils.m
View
5 clcg_device_utils.h
@@ -63,10 +63,13 @@ extern "C" {
/** @return YES if the device has a Retina display. */
BOOL clcg_has_retina(void);
-
+
/** @return YES if the device is an iPad. */
BOOL clcg_is_ipad(void);
+ /** @return YES if the device is iPhone or iPod type device. */
+ BOOL clcg_is_iphone(void);
+
/** @return YES if the device is an iPhone5 or other tall non-tablet device. */
BOOL clcg_is_iphone5(void);
View
23 clcg_device_utils.m
@@ -41,19 +41,26 @@ BOOL clcg_os_geq(NSString* version)
}
-BOOL clcg_is_iphone5(void)
+BOOL clcg_is_ipad(void)
{
- CGSize sz = [[UIScreen mainScreen] bounds].size;
- return (!clcg_is_ipad() && sz.height > 480.0f);
+ if (clcg_os_geq(@"3.2")) {
+ return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad;
+ } else {
+ return NO;
+ }
}
-BOOL clcg_is_ipad(void)
+BOOL clcg_is_iphone(void)
{
- if (clcg_os_geq(@"3.2"))
- return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad;
- else
- return NO;
+ return clcg_is_ipad() == NO;
+}
+
+
+BOOL clcg_is_iphone5(void)
+{
+ CGSize sz = [[UIScreen mainScreen] bounds].size;
+ return (clcg_is_iphone() && sz.height > 480.0f);
}
Please sign in to comment.
Something went wrong with that request. Please try again.