Skip to content

Commit

Permalink
fixed the bug occurred in iOS9, when i use after SIAlertView, the key…
Browse files Browse the repository at this point in the history
…window = nil, lead to something Breaks scroll to top left, ex use the SVProgressHUD
  • Loading branch information
maintiendrai committed Oct 14, 2015
1 parent 747e53d commit 57634a0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions SIAlertView/SIAlertView.m
Expand Up @@ -883,6 +883,19 @@ - (void)setup

- (void)teardown
{
NSEnumerator *frontToBackWindows = [UIApplication.sharedApplication.windows reverseObjectEnumerator];

for (UIWindow *window in frontToBackWindows){
BOOL windowOnMainScreen = window.screen == UIScreen.mainScreen;
BOOL windowIsVisible = !window.hidden && window.alpha > 0;
BOOL windowLevelNormal = window.windowLevel == UIWindowLevelNormal;

if (windowOnMainScreen && windowIsVisible && windowLevelNormal) {
[window makeKeyAndVisible];
break;
}
}

[self.containerView removeFromSuperview];
self.containerView = nil;
self.titleLabel = nil;
Expand Down

0 comments on commit 57634a0

Please sign in to comment.