Animating UITextInput's textInputView

情到浓时终转凉″ 提交于 2019-12-05 07:53:14

From the UIResponder docs:

Responder objects that require a custom view to gather input from the user should redeclare this property as readwrite and use it to manage their custom input view. When the receiver subsequently becomes the first responder, the responder infrastructure presents the specified input view automatically. Similarly, when the view resigns its first responder status, the responder infrastructure automatically dismisses the specified view.

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

  1. Actually there is a method to do it cleanly: UIResponder's reloadInputViews, available from iOS 3.2!

  2. I think you can animated it with some extra work:

    • Create a clear background window of a higher UIWindowLevel than the keyboard window.
    • Add your custom keyboard there and animate its frame into place.
    • Then set it as your text input's inputView and refresh the first responder as you do.

Your custom keyboard will change its parent view from your custom window to the keyboard one, but hopefully the user won't notice ;)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!