diff --git a/Demo/DemoViewController.swift b/Demo/DemoViewController.swift index 7ce1a08..2a60cb7 100644 --- a/Demo/DemoViewController.swift +++ b/Demo/DemoViewController.swift @@ -10,13 +10,27 @@ import UIKit import PKHUD class DemoViewController: UIViewController { + + let hiddenTextField = UITextField(frame: CGRect.zero) + override func viewDidLoad() { super.viewDidLoad() + view.addSubview(hiddenTextField) + HUD.registerForKeyboardNotifications() + HUD.dimsBackground = false HUD.allowsInteraction = false } + + @IBAction func showHideKeyboard(_ sender: Any) { + if hiddenTextField.isEditing { + view.endEditing(true) + } else { + hiddenTextField.becomeFirstResponder() + } + } @IBAction func showAnimatedSuccessHUD(_ sender: AnyObject) { HUD.flash(.success, delay: 2.0) @@ -50,6 +64,10 @@ class DemoViewController: UIViewController { print("License Obtained.") } } + + deinit { + HUD.deregisterFromKeyboardNotifications() + } /* diff --git a/Demo/Storyboard.storyboard b/Demo/Storyboard.storyboard index 0a1f7c0..b21ddf8 100644 --- a/Demo/Storyboard.storyboard +++ b/Demo/Storyboard.storyboard @@ -1,8 +1,12 @@ - - + + + + + - - + + + @@ -14,100 +18,115 @@ - + - + - - + + +