UITextInput animation textInputView animation

UIKit text input components, such as UITextView and UITextField , have an inputView property to add a custom keyboard. There are two questions that I have in connection with this.

  • If the keyboard is currently visible and the property is set to a new input view, nothing happens. Canceling and restoring the status of the first responder updates the input and displays a new view. Is this the best way to do this? If so, it can answer my big question:

  • Is it possible to animate the transition between two input representations?

+6
source share
2 answers

From the UIResponder docs:

Responder objects that require a custom view to collect input from the user should reuse this property as readwrite and use it to control their custom input view. When the recipient subsequently becomes the first responder, the responder infrastructure automatically presents the specified input. Similarly, when a view resets the status of the first responder, the responder infrastructure automatically rejects the specified view.

So, unfortunately, the answer to 1 is Yes and 2 is No.

+1
source
  • There is actually a way to do this cleanly: UIResponder reloadInputViews , available from iOS 3.2!

  • I think you can animate it with some extra work:

    • Create a transparent background window of a higher UIWindowLevel than the keyboard window.
    • Add your own keyboard and raise its frame.
    • Then set it as inputView text and update the first responder just like you.

Your user keyboard will change the parent view from your user window to the keyboard, but hopefully the user will not notice;)

0
source

All Articles