Skip to content

Instantly share code, notes, and snippets.

@timqzm
Last active July 5, 2017 12:53
Show Gist options
  • Save timqzm/df7f462f12d6efd9070a19c72a52f932 to your computer and use it in GitHub Desktop.
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
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
}
@timqzm
Copy link
Author

timqzm commented Jul 3, 2017

@PGLongo
NO, I don't want replace the keyboard. I just want to see it like this:
what_i_want
Is there a way to do so?

@PGLongo
Copy link

PGLongo commented Jul 4, 2017

You need to do this:
HUD.show(.progress, onView: UIApplication.shared.windows.last)

@timqzm
Copy link
Author

timqzm commented Jul 5, 2017

@PGLongo works perfectly, thx a lot!

screen shot 2017-07-05 at 15 24 33

@PGLongo
Copy link

PGLongo commented Jul 5, 2017

You are welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment