Last active
July 5, 2017 12:53
-
-
Save timqzm/df7f462f12d6efd9070a19c72a52f932 to your computer and use it in GitHub Desktop.
How to set PKHUD above keyboard AND inputAccessoryView? https://stackoverflow.com/questions/44840460/how-to-set-pkhud-above-inputaccessoryview
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var activeTextField: UITextField? | |
@IBAction func logIn(_ sender: Any) { | |
// ... | |
HUD.flash(.labeledError(title: "blabla", subtitle: "blablalba"), | |
onView: activeTextField?.inputAccessoryView, | |
delay: 1.0) | |
// ... | |
} | |
func textFieldDidBeginEditing(_ textField: UITextField) { | |
activeTextField = textField // if keyboard is shown, show HUD.flash under inputAccessoryView | |
} | |
func textFieldDidEndEditing(_ textField: UITextField) { | |
activeTextField = nil // if keyboard isn't shown, just show simple HUD.flash | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to do this:
HUD.show(.progress, onView: UIApplication.shared.windows.last)