3636static SIAlertBackgroundWindow *__si_alert_background_window;
3737static SIAlertView *__si_alert_current_view;
3838
39- #ifdef __IPHONE_7_0
40- @interface UIWindow (SIAlert_StatusBarUtils)
39+ @interface UIWindow (SIAlert_Utils)
4140
42- - (UIViewController *)viewControllerForStatusBarStyle ;
43- - (UIViewController *)viewControllerForStatusBarHidden ;
41+ - (UIViewController *)currentViewController ;
4442
4543@end
4644
47- @implementation UIWindow (SIAlert_StatusBarUtils )
45+ @implementation UIWindow (SIAlert_Utils )
4846
4947- (UIViewController *)currentViewController
5048{
@@ -55,6 +53,18 @@ - (UIViewController *)currentViewController
5553 return viewController;
5654}
5755
56+ @end
57+
58+ #ifdef __IPHONE_7_0
59+ @interface UIWindow (SIAlert_StatusBarUtils)
60+
61+ - (UIViewController *)viewControllerForStatusBarStyle ;
62+ - (UIViewController *)viewControllerForStatusBarHidden ;
63+
64+ @end
65+
66+ @implementation UIWindow (SIAlert_StatusBarUtils)
67+
5868- (UIViewController *)viewControllerForStatusBarStyle
5969{
6070 UIViewController *currentViewController = [self currentViewController ];
@@ -223,16 +233,28 @@ - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInte
223233
224234- (NSUInteger )supportedInterfaceOrientations
225235{
236+ UIViewController *viewController = [self .alertView.oldKeyWindow currentViewController ];
237+ if (viewController) {
238+ return [viewController supportedInterfaceOrientations ];
239+ }
226240 return UIInterfaceOrientationMaskAll;
227241}
228242
229243- (BOOL )shouldAutorotateToInterfaceOrientation : (UIInterfaceOrientation)toInterfaceOrientation
230244{
245+ UIViewController *viewController = [self .alertView.oldKeyWindow currentViewController ];
246+ if (viewController) {
247+ return [viewController shouldAutorotateToInterfaceOrientation: toInterfaceOrientation];
248+ }
231249 return YES ;
232250}
233251
234252- (BOOL )shouldAutorotate
235253{
254+ UIViewController *viewController = [self .alertView.oldKeyWindow currentViewController ];
255+ if (viewController) {
256+ return [viewController shouldAutorotate ];
257+ }
236258 return YES ;
237259}
238260
0 commit comments