Skip to content

Commit

Permalink
Fixing keyboard visibility bug in WhistleFactory
Browse files Browse the repository at this point in the history
As detailed in https://stackoverflow.com/questions/15554481/keyboard-doesnt-come-up-with-multiple-uiwindows
using makeKeyAndVisible() causes the keyboard to dismiss. Prefer using isHidden = false instead to avoid this side-effect.
  • Loading branch information
jondwillis authored Oct 19, 2017
1 parent 8515f4d commit a0ac9a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/WhistleFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ open class WhistleFactory: UIViewController {

let initialOrigin = whistleWindow.frame.origin.y
whistleWindow.frame.origin.y = initialOrigin - titleLabelHeight
whistleWindow.makeKeyAndVisible()
whistleWindow.isHidden = false
UIView.animate(withDuration: 0.2, animations: {
self.whistleWindow.frame.origin.y = initialOrigin
})
Expand All @@ -151,7 +151,7 @@ open class WhistleFactory: UIViewController {
self.whistleWindow.frame.origin.y = finalOrigin
}, completion: { _ in
if let window = self.previousKeyWindow {
window.makeKeyAndVisible()
window.isHidden = false
self.whistleWindow.windowLevel = UIWindowLevelNormal - 1
self.previousKeyWindow = nil
window.rootViewController?.setNeedsStatusBarAppearanceUpdate()
Expand Down

0 comments on commit a0ac9a5

Please sign in to comment.