@@ -56,8 +56,8 @@ @interface LGActionSheet () <UITableViewDataSource, UITableViewDelegate, UIGestu
5656@property (assign , nonatomic , getter =isExists) BOOL exists;
5757
5858@property (strong , nonatomic ) UIWindow *window;
59- @property (assign , nonatomic ) UIWindow *windowPrevious;
60- @property (assign , nonatomic ) UIWindow *windowNotice;
59+ @property (strong , nonatomic ) UIWindow *windowPrevious;
60+ @property (strong , nonatomic ) UIWindow *windowNotice;
6161
6262@property (strong , nonatomic ) UIView *view;
6363
@@ -179,6 +179,11 @@ - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIVi
179179
180180#endif
181181
182+ - (UIStatusBarStyle)preferredStatusBarStyle
183+ {
184+ return [UIApplication sharedApplication ].statusBarStyle ;
185+ }
186+
182187@end
183188
184189@implementation LGActionSheet
@@ -510,13 +515,17 @@ - (void)windowVisibleChanged:(NSNotification *)notification
510515
511516 UIWindow *window = notification.object ;
512517
518+ // NSLog(@"%@", NSStringFromClass([window class]));
519+
520+ if ([window isEqual: _window]) return ;
521+
513522 if (notification.name == UIWindowDidBecomeVisibleNotification)
514523 {
515524 if ([window isEqual: _windowPrevious])
516525 {
517526 window.hidden = YES ;
518527 }
519- else if (![window isEqual: _window] && ! _windowNotice)
528+ else if (!_windowNotice)
520529 {
521530 _windowNotice = window;
522531
@@ -525,19 +534,11 @@ - (void)windowVisibleChanged:(NSNotification *)notification
525534 }
526535 else if (notification.name == UIWindowDidBecomeHiddenNotification)
527536 {
528- __weak UIView *view = window.subviews .lastObject ;
529-
530- if (![window isEqual: _window] && [window isEqual: _windowNotice])
537+ if ([window isEqual: _windowNotice])
531538 {
532- dispatch_after (dispatch_time (DISPATCH_TIME_NOW, (int64_t )(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue (), ^(void )
533- {
534- if (!view)
535- {
536- _windowNotice = nil ;
537-
538- [_window makeKeyAndVisible ];
539- }
540- });
539+ _windowNotice = nil ;
540+
541+ [_window makeKeyAndVisible ];
541542 }
542543 }
543544}
0 commit comments