Skip to content

Commit

Permalink
added support for iPhone 6 and iPhone 6 Plus
Browse files Browse the repository at this point in the history
  • Loading branch information
carlj committed Sep 10, 2014
1 parent a67bf6d commit 0fe0fcd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CJAMacros.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "CJAMacros"
s.version = "2.0.6"
s.version = "2.0.7"
s.platform = :ios, "6.0"
s.summary = "Macro collection for daily usage"
s.homepage = "https://github.com/carlj/CJAMacros"
Expand Down
16 changes: 13 additions & 3 deletions CJAMacros/CJAMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ _lambda \
#define DEFINE_KEY( key ) NSString *const key = @ #key;
#define DEFINE_KEY_WITH_VALUE( key, property ) NSString *const key = @ #property;


///---------------------------
/// @name Device Checks
///---------------------------
Expand All @@ -81,7 +80,19 @@ _lambda \
Runtime check for the current device.
checks if the current device is an iPhone 5 or iPod Touch 5 Gen, or an Device with 1136 Screen height
*/
#define DEVICE_IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
#define DEVICE_IS_IPHONE_5 ( fabsf(CGRectGetWidth([UIScreen mainScreen].bounds) - 568.f) < FLT_EPSILON )

/**
Runtime check for the current device.
checks if the current device is an iPhone 6
*/
#define DEVICE_IS_IPHONE_6 ( fabsf(CGRectGetWidth([UIScreen mainScreen].bounds) - 667.f) < FLT_EPSILON )

/**
Runtime check for the current device.
checks if the current device is an iPhone 6 Plus
*/
#define DEVICE_IS_IPHONE_6_PLUS ( fabsf(CGRectGetWidth([UIScreen mainScreen].bounds) - 960.f) < FLT_EPSILON )

/**
Runtime check for the current device.
Expand Down Expand Up @@ -294,4 +305,3 @@ return sharedInstance; \
Compare two float objects
*/
#define CJAFloatEqual(_first, _second) (fabsf( _first - _second ) < FLT_EPSILON)

8 changes: 8 additions & 0 deletions Example/Classes/DemoViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ - (void)performDeviceChecks {
if (DEVICE_IS_IPHONE_5) {
NSLog(@"The current device is an iPhone 5 or iPod Touch 5 Gen.");
}

if (DEVICE_IS_IPHONE_6) {
NSLog(@"The current device is an iPhone 6");
}

if (DEVICE_IS_IPHONE_6_PLUS) {
NSLog(@"The current device is an iPhone 6 Plus");
}
}

- (void)performKeyDeclaration {
Expand Down

0 comments on commit 0fe0fcd

Please sign in to comment.