Search code examples
iosswiftkeyboarduitextfield

Refresh keyboard without resigning and becoming first responder


I'm wondering if there is possibility to refresh the keyboard, to be specifically, to be have the appearance of the dark or light keyboard without resigning and then first responder -

textField.resignFirstResponder()
self.keyboardAppearance = UIKeyboardAppearance.dark
textField.becomeFirstResponder()

I have a button for brightness for the uitextfield to be dark/light. I tried to resign the textfield and then textfield become first responder. It doesn't look pretty.

I would like to get the keyboard to play along. Is it possible to make the keyboard stay up and animate from light to dark vice versa?


Solution

  • Try this:

    textField.reloadInputViews()