动画UITextInput的textInputView [英] Animating UITextInput's textInputView

查看:122
本文介绍了动画UITextInput的textInputView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UIKit文本输入组件(例如UITextViewUITextField)具有属性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.

  1. 如果键盘当前可见,并且属性设置为新的输入视图,则不会发生任何事情.退出并重新获得第一响应者状态将刷新输入并显示新视图.这是最好的方法吗?如果是这样,它可能会回答我更大的问题:

  1. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆