Skip to content

Commit

Permalink
Merge pull request cruffenach#183 from vladzz/master
Browse files Browse the repository at this point in the history
Fixes a crashing issue on snapshot between iOS7 and iOS8
  • Loading branch information
Ashton-W committed Oct 17, 2015
2 parents 3f7d99e + 1a72072 commit 620fef2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CRToast/CRToast.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#import "CRToastManager.h"
#import <UIKit/UIKit.h>

#define IS_OS_8_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)

@class CRToastSwipeGestureRecognizer, CRToastTapGestureRecognizer;

/**
Expand Down
14 changes: 10 additions & 4 deletions CRToast/CRToastLayoutHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,13 @@ static CGRect CRGetNotificationContainerFrame(UIInterfaceOrientation statusBarOr

/// Get view snapshot. If `underStatusBar` it will get key windows root view controller. Otherwise it'll get the mainscreens snapshot
static UIView *CRStatusBarSnapShotView(BOOL underStatusBar) {
return underStatusBar ?
[[UIApplication sharedApplication].keyWindow.rootViewController.view snapshotViewAfterScreenUpdates:YES] :
[[UIScreen mainScreen] snapshotViewAfterScreenUpdates:YES];
}
if(IS_OS_8_OR_LATER){
return underStatusBar ?
[[UIApplication sharedApplication].keyWindow.rootViewController.view snapshotViewAfterScreenUpdates:YES] :
[[UIScreen mainScreen] snapshotViewAfterScreenUpdates:YES];
} else {
return underStatusBar ?
[[UIApplication sharedApplication].keyWindow.rootViewController.view snapshotViewAfterScreenUpdates:NO] :
[[UIScreen mainScreen] snapshotViewAfterScreenUpdates:NO];
}
}

0 comments on commit 620fef2

Please sign in to comment.