动画UITextInput的textInputView [英] Animating UITextInput's textInputView
问题描述
UIKit文本输入组件(例如UITextView
和UITextField
)具有属性inputView
来添加自定义键盘.我有两个与此有关的问题.
UIKit text input components, such as UITextView
and UITextField
have a property inputView
to add a custom keyboard. There are two questions I have relating to this.
-
如果键盘当前可见,并且属性设置为新的输入视图,则不会发生任何事情.退出并重新获得第一响应者状态将刷新输入并显示新视图.这是最好的方法吗?如果是这样,它可能会回答我更大的问题:
If the keyboard is currently visible and the property is set to a new input view, nothing happens. Resigning and regaining first responder status refreshes the input and displays the new view. Is this the best way to do it? If so it might answer my bigger question:
是否可以为两个输入视图之间的过渡设置动画?
Is it possible to animate the transition between two input views?
推荐答案
来自UIResponder文档:
From the UIResponder docs:
需要自定义视图来收集用户输入的响应者对象应将此属性重新声明为readwrite,并使用它来管理其自定义输入视图.当接收者随后成为第一响应者时,响应者基础结构会自动显示指定的输入视图.同样,当视图退出其第一响应者状态时,响应者基础结构会自动关闭指定的视图.
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.
不幸的是,对1的回答是是",对2的回答是否".
So unfortunately the answer to 1 is Yes and 2 is No.
这篇关于动画UITextInput的textInputView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!