Skip to content

Commit

Permalink
fixed #11 (For iOS 8 the DEVICE_IS_IPHONE_... macros are not valid)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlj committed Oct 6, 2014
1 parent 78afc25 commit 1c90058
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 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.1.0"
s.version = "2.1.1"
s.platform = :ios, "6.0"
s.summary = "Macro collection for daily usage"
s.homepage = "https://github.com/carlj/CJAMacros"
Expand Down
8 changes: 5 additions & 3 deletions CJAMacros/CJAMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,25 @@ _lambda \
/// @name Device Checks
///---------------------------

#define DEVICE_SCREEN_HAS_LENGTH(_frame, _length) ( fabsf( MAX(CGRectGetHeight(_frame), CGRectGetWidth(_frame)) - _length) < FLT_EPSILON )

/**
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 ( fabsf(CGRectGetHeight([UIScreen mainScreen].bounds) - 568.f) < FLT_EPSILON )
#define DEVICE_IS_IPHONE_5 DEVICE_SCREEN_HAS_LENGTH([UIScreen mainScreen].bounds, 568.f)

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

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

/**
Runtime check for the current device.
Expand Down
2 changes: 1 addition & 1 deletion Example/Classes/DemoViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ - (void)performMainThreadMacro {
- (void)performRuntimeChecks {

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO( _iOS_7_0) ) {
NSLog(@"Why are on iOS 7");
NSLog(@"Why are on iOS 7 or greater");
}

//you can always use the normal NSFoundationVersionNumber's
Expand Down

0 comments on commit 1c90058

Please sign in to comment.