Skip to content

Commit

Permalink
Wrap calls to UITrailCollection and size classes in #if block.
Browse files Browse the repository at this point in the history
Wrapping in efforts to fix compilation issues under iOS 7SDK
  • Loading branch information
dmiedema committed Jan 4, 2015
1 parent 8e32a94 commit bab0bb5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions CRToast/CRToastLayoutHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
#import <Foundation/Foundation.h>
#import "CRToast.h" // For NS_ENUM values

static BOOL CRHorizontalSizeClassRegular() {
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_7_1
return [UIScreen mainScreen].traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular;
#endif
return NO;
}

#pragma mark - Variables
/**
`BOOL` to determine if the frame is automatically adjusted for orientation. iOS 8 automatically accounts for orientation when getting frame where as iOS 7 does not.
Expand Down Expand Up @@ -75,8 +82,7 @@ static CGFloat CRGetStatusBarWidth() {
static CGFloat CRGetNavigationBarHeightForOrientation(UIInterfaceOrientation orientation) {
BOOL regularHorizontalSizeClass = NO;
if (kCRUseSizeClass) {
UITraitCollection *traitCollection = [[UIScreen mainScreen] traitCollection];
regularHorizontalSizeClass = traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular;
regularHorizontalSizeClass = CRHorizontalSizeClassRegular();
}
return (UIDeviceOrientationIsPortrait(orientation) ||
UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad || regularHorizontalSizeClass) ?
Expand Down

0 comments on commit bab0bb5

Please sign in to comment.