Skip to content

Commit

Permalink
Merge pull request #19 from yoavlt/fixBounds
Browse files Browse the repository at this point in the history
fix for ios8 mainScreen bounds
  • Loading branch information
cezarywojcik committed Oct 5, 2014
2 parents 7f2b644 + 876d01b commit d159a08
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions CWPopup/UIViewController+CWPopup.m
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ @implementation UIViewController (CWPopup)
- (UIImage *)getScreenImage {
// frame without status bar
CGRect frame;
if (UIDeviceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
if (UIDeviceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation) || NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1) {
frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
} else {
frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width);
Expand Down Expand Up @@ -200,7 +200,7 @@ - (UIImage *)getBlurredImage:(UIImage *)imageToBlur {

- (void)addBlurView {
UIImageView *blurView = [UIImageView new];
if (UIDeviceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
if (UIDeviceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation) || NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1) {
blurView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
} else {
blurView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width);
Expand Down Expand Up @@ -249,7 +249,7 @@ - (void)presentPopupViewController:(UIViewController *)viewControllerToPresent a
[self addBlurView];
} else {
UIView *fadeView = [UIImageView new];
if (UIDeviceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
if (UIDeviceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation) || NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1) {
fadeView.frame = [UIScreen mainScreen].bounds;
} else {
fadeView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width);
Expand Down Expand Up @@ -327,7 +327,7 @@ - (CGRect)getPopupFrameForViewController:(UIViewController *)viewController {
CGRect frame = viewController.view.frame;
CGFloat x;
CGFloat y;
if (UIDeviceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
if (UIDeviceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation) || NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1) {
x = ([UIScreen mainScreen].bounds.size.width - frame.size.width)/2;
y = ([UIScreen mainScreen].bounds.size.height - frame.size.height)/2;
} else {
Expand All @@ -342,7 +342,7 @@ - (void)screenOrientationChanged {
UIView *blurView = objc_getAssociatedObject(self, &CWBlurViewKey);
[UIView animateWithDuration:ANIMATION_TIME animations:^{
self.popupViewController.view.frame = [self getPopupFrameForViewController:self.popupViewController];
if (UIDeviceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
if (UIDeviceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation) || NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1) {
blurView.frame = [UIScreen mainScreen].bounds;
} else {
blurView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width);
Expand Down

0 comments on commit d159a08

Please sign in to comment.