Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
kennic committed Feb 1, 2021
1 parent 60a73f2 commit 07a3ab3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion NKModalPresenter.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'NKModalPresenter'
s.version = '1.6.3'
s.version = '1.6.4'
s.summary = 'Present UIViewController modally'
s.description = <<-DESC
Present UIViewController modally easily and beautifully with animation.
Expand Down
22 changes: 13 additions & 9 deletions NKModalPresenter/NKModalController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public extension NKModalControllerDelegate {
func backgroundColor(modalController: NKModalController) -> UIColor { return NKModalController.backgroundColor }
func cornerRadius(modalController: NKModalController) -> CGFloat { return NKModalController.cornerRadius }
func cornerMask(modalController: NKModalController) -> CACornerMask { return [.layerMaxXMaxYCorner, .layerMaxXMinYCorner, .layerMinXMaxYCorner, .layerMinXMinYCorner] }
func windowLevel(modalController: NKModalController) -> UIWindow.Level { return .normal }
func windowLevel(modalController: NKModalController) -> UIWindow.Level { return .normal + 1 }
func transitionView(modalController: NKModalController) -> UIView? { return nil }

}
Expand Down Expand Up @@ -255,7 +255,7 @@ public class NKModalController: NKModalContainerViewController {

let containerView = UIView()
var window: UIWindow?
var lastWindow: UIWindow?
weak var lastWindow: UIWindow?
var lastPosition: (container: UIView, frame: CGRect)?
var anchorCapturedView: UIImageView?
var contentCapturedView: UIImageView?
Expand Down Expand Up @@ -622,24 +622,28 @@ public class NKModalController: NKModalContainerViewController {
self.isAnimating = false
self.isDismissing = false

if NKModalPresenter.shared.activeModalControllers.isEmpty {
self.lastWindow?.makeKeyAndVisible()
}
else {
self.lastWindow = nil
}

self.window?.rootViewController?.resignFirstResponder()
self.window?.rootViewController = nil
self.window?.removeFromSuperview()
self.window = nil

if NKModalPresenter.shared.activeModalControllers.isEmpty || NKModalPresenter.shared.topModalController == self {
self.lastWindow?.makeKeyAndVisible()
}

self.lastWindow = nil

self.didDismiss?(self)
self.delegate?.modalController(self, didDismiss: self.contentViewController)
NotificationCenter.default.post(name: NKModalController.didDismiss, object: self, userInfo: nil)

self.contentView = nil
self.contentViewController = nil

if UIWindow.keyWindow == nil {
UIApplication.shared.windows.last?.makeKeyAndVisible()
}

completion?()
}
}
Expand Down

0 comments on commit 07a3ab3

Please sign in to comment.