From 57634a006b2f3ce72f49a17c1fa8e788d049652a Mon Sep 17 00:00:00 2001 From: lilkr Date: Wed, 14 Oct 2015 11:27:45 +0800 Subject: [PATCH 1/3] fixed the bug occurred in iOS9, when i use after SIAlertView, the keywindow = nil, lead to something Breaks scroll to top left, ex use the SVProgressHUD --- SIAlertView/SIAlertView.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/SIAlertView/SIAlertView.m b/SIAlertView/SIAlertView.m index 7a67df3..9f03b93 100644 --- a/SIAlertView/SIAlertView.m +++ b/SIAlertView/SIAlertView.m @@ -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; From d5894ad64b9d048cd87deac94f9383a2fc06d3e5 Mon Sep 17 00:00:00 2001 From: lilkr <“maintiendrai@gmail.com”> Date: Wed, 14 Oct 2015 11:33:21 +0800 Subject: [PATCH 2/3] fixed the bug occurred in iOS9, when i use after SIAlertView, the keywindow = nil, lead to something Breaks scroll to top left, ex use the SVProgressHUD --- SIAlertView/SIAlertView.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SIAlertView/SIAlertView.m b/SIAlertView/SIAlertView.m index 9f03b93..c213007 100644 --- a/SIAlertView/SIAlertView.m +++ b/SIAlertView/SIAlertView.m @@ -883,6 +883,12 @@ - (void)setup - (void)teardown { + [self.containerView removeFromSuperview]; + self.containerView = nil; + self.titleLabel = nil; + self.messageLabel = nil; + [self.buttons removeAllObjects]; + NSEnumerator *frontToBackWindows = [UIApplication.sharedApplication.windows reverseObjectEnumerator]; for (UIWindow *window in frontToBackWindows){ @@ -895,12 +901,6 @@ - (void)teardown break; } } - - [self.containerView removeFromSuperview]; - self.containerView = nil; - self.titleLabel = nil; - self.messageLabel = nil; - [self.buttons removeAllObjects]; [self.alertWindow removeFromSuperview]; self.alertWindow = nil; self.layoutDirty = NO; From 21fca78eea45ec71f4eaf52877311d8ca9d4ed75 Mon Sep 17 00:00:00 2001 From: lilkr Date: Wed, 14 Oct 2015 11:40:56 +0800 Subject: [PATCH 3/3] fixed the bug occurred in iOS9, when i use after SIAlertView, the keywindow = nil, lead to something Breaks scroll to top left, ex use the SVProgressHUD --- SIAlertView/SIAlertView.m | 1 + 1 file changed, 1 insertion(+) diff --git a/SIAlertView/SIAlertView.m b/SIAlertView/SIAlertView.m index c213007..0d46a47 100644 --- a/SIAlertView/SIAlertView.m +++ b/SIAlertView/SIAlertView.m @@ -901,6 +901,7 @@ - (void)teardown break; } } + [self.alertWindow removeFromSuperview]; self.alertWindow = nil; self.layoutDirty = NO;