Skip to content
This repository was archived by the owner on Apr 27, 2019. It is now read-only.

Commit c428a20

Browse files
author
Carson Perrotti
committed
Fix rotation bug
1 parent db8a86d commit c428a20

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

CNPPopupController/CNPPopupController.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#import "CNPPopupController.h"
1010
#import <QuartzCore/QuartzCore.h>
1111

12+
#define CNP_SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
1213
#define CNP_IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
1314

1415
typedef struct {
@@ -77,8 +78,10 @@ - (instancetype)initWithTitle:(NSAttributedString *)popupTitle
7778
}
7879
}
7980

80-
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarFrameOrOrientationChanged:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
81-
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarFrameOrOrientationChanged:) name:UIApplicationDidChangeStatusBarFrameNotification object:nil];
81+
if (CNP_SYSTEM_VERSION_LESS_THAN(@"8.0")) {
82+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarFrameOrOrientationChanged:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
83+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarFrameOrOrientationChanged:) name:UIApplicationDidChangeStatusBarFrameNotification object:nil];
84+
}
8285
}
8386
return self;
8487
}
@@ -245,7 +248,9 @@ - (void)presentPopupControllerAnimated:(BOOL)flag {
245248
// Safety Checks
246249
NSAssert(self.theme!=nil,@"You must set a theme. You can use [CNPTheme defaultTheme] as a starting place");
247250
[self setUpPopup];
248-
[self rotateAccordingToStatusBarOrientationAndSupportedOrientations];
251+
if (CNP_SYSTEM_VERSION_LESS_THAN(@"8.0")) {
252+
[self rotateAccordingToStatusBarOrientationAndSupportedOrientations];
253+
}
249254
[self setDismissedConstraints];
250255
[self.maskView needsUpdateConstraints];
251256
[self.maskView layoutIfNeeded];

0 commit comments

Comments
 (0)