From 11b0d9fc519b5c9a0b23a883139b4daa4d05815c Mon Sep 17 00:00:00 2001 From: Piyush Date: Wed, 4 Jul 2018 13:02:33 +0530 Subject: [PATCH 1/3] Bugs Fixes 1. Split View issue fixed 2. When Split View added, removed orientation of background view not updated - issue fixed --- Pod/Classes/ZAlertView.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Pod/Classes/ZAlertView.swift b/Pod/Classes/ZAlertView.swift index c9a9bf2..35d821b 100644 --- a/Pod/Classes/ZAlertView.swift +++ b/Pod/Classes/ZAlertView.swift @@ -443,6 +443,7 @@ import UIKit self.height += ZAlertView.padding let bounds = UIScreen.main.bounds self.alertView.frame = CGRect(x: bounds.width/2 - width/2, y: bounds.height/2 - height/2, width: width, height: height) + let bounds = self.backgroundView.bounds } // MARK: - Override methods @@ -882,4 +883,19 @@ import UIKit } } + + override open func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { + super.viewWillTransition(to: size, with: coordinator) + self.perform(#selector(self.updateFrame), with: nil, afterDelay: 0.2) + } + + /// Update background view frame + @objc func updateFrame() { + guard let window = UIApplication.shared.keyWindow else { + return + } + print(window.bounds) + self.backgroundView.frame = window.bounds + } } + From 1743858757e208961a12e454568deff187221c82 Mon Sep 17 00:00:00 2001 From: Piyush Date: Wed, 4 Jul 2018 13:13:00 +0530 Subject: [PATCH 2/3] Updated code --- Pod/Classes/ZAlertView.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Pod/Classes/ZAlertView.swift b/Pod/Classes/ZAlertView.swift index 35d821b..12c5b41 100644 --- a/Pod/Classes/ZAlertView.swift +++ b/Pod/Classes/ZAlertView.swift @@ -441,9 +441,8 @@ import UIKit } self.height += ZAlertView.padding - let bounds = UIScreen.main.bounds - self.alertView.frame = CGRect(x: bounds.width/2 - width/2, y: bounds.height/2 - height/2, width: width, height: height) let bounds = self.backgroundView.bounds + self.alertView.frame = CGRect(x: bounds.width / 2 - width / 2, y: bounds.height / 2 - height / 2, width: width, height: height) } // MARK: - Override methods From 5a012a49b4e1c2042382f38e3501e3f7f0c76580 Mon Sep 17 00:00:00 2001 From: Piyush Date: Wed, 4 Jul 2018 13:14:00 +0530 Subject: [PATCH 3/3] Updated code --- Pod/Classes/ZAlertView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pod/Classes/ZAlertView.swift b/Pod/Classes/ZAlertView.swift index 12c5b41..aa01031 100644 --- a/Pod/Classes/ZAlertView.swift +++ b/Pod/Classes/ZAlertView.swift @@ -442,7 +442,7 @@ import UIKit self.height += ZAlertView.padding let bounds = self.backgroundView.bounds - self.alertView.frame = CGRect(x: bounds.width / 2 - width / 2, y: bounds.height / 2 - height / 2, width: width, height: height) + self.alertView.frame = CGRect(x: bounds.width/2 - width/2, y: bounds.height/2 - height/2, width: width, height: height) } // MARK: - Override methods