|
7 | 7 | // |
8 | 8 |
|
9 | 9 | #import "SIAlertView.h" |
| 10 | +#import "UIWindow+SIUtils.h" |
10 | 11 | #import <QuartzCore/QuartzCore.h> |
11 | 12 |
|
12 | 13 | NSString *const SIAlertViewWillShowNotification = @"SIAlertViewWillShowNotification"; |
|
36 | 37 | static SIAlertBackgroundWindow *__si_alert_background_window; |
37 | 38 | static SIAlertView *__si_alert_current_view; |
38 | 39 |
|
39 | | -@interface UIWindow (SIAlert_Utils) |
40 | | - |
41 | | -- (UIViewController *)currentViewController; |
42 | | - |
43 | | -@end |
44 | | - |
45 | | -@implementation UIWindow (SIAlert_Utils) |
46 | | - |
47 | | -- (UIViewController *)currentViewController |
48 | | -{ |
49 | | - UIViewController *viewController = self.rootViewController; |
50 | | - while (viewController.presentedViewController) { |
51 | | - viewController = viewController.presentedViewController; |
52 | | - } |
53 | | - return viewController; |
54 | | -} |
55 | | - |
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 | | - |
68 | | -- (UIViewController *)viewControllerForStatusBarStyle |
69 | | -{ |
70 | | - UIViewController *currentViewController = [self currentViewController]; |
71 | | - |
72 | | - while ([currentViewController childViewControllerForStatusBarStyle]) { |
73 | | - currentViewController = [currentViewController childViewControllerForStatusBarStyle]; |
74 | | - } |
75 | | - return currentViewController; |
76 | | -} |
77 | | - |
78 | | -- (UIViewController *)viewControllerForStatusBarHidden |
79 | | -{ |
80 | | - UIViewController *currentViewController = [self currentViewController]; |
81 | | - |
82 | | - while ([currentViewController childViewControllerForStatusBarHidden]) { |
83 | | - currentViewController = [currentViewController childViewControllerForStatusBarHidden]; |
84 | | - } |
85 | | - return currentViewController; |
86 | | -} |
87 | | - |
88 | | -@end |
89 | | -#endif |
90 | | - |
91 | | - |
92 | 40 | @interface SIAlertView () |
93 | 41 |
|
94 | 42 | @property (nonatomic, strong) NSMutableArray *items; |
|
0 commit comments