Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions SIAlertView/SIAlertView.m
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,20 @@ - (void)teardown
self.titleLabel = nil;
self.messageLabel = nil;
[self.buttons removeAllObjects];

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.alertWindow removeFromSuperview];
self.alertWindow = nil;
self.layoutDirty = NO;
Expand Down