如何禁用 UITextField 键盘而不隐藏它? [英] How to disable a UITextField keyboard without hiding it?

查看:26
本文介绍了如何禁用 UITextField 键盘而不隐藏它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个动画,在此期间我想禁用键盘但不隐藏它.我什至尝试过 self.view.userInteractionEnabled = NO;,但这隐藏了键盘.我想它必须调用 resignFirstResponder.

I have an animation, during which I want to disable the keyboard but not hide it. I even tried self.view.userInteractionEnabled = NO;, but that hides the keyboard. I guess it must call resignFirstResponder.

推荐答案

要禁用一切,您可以使用

To disable everything, you can use

[[UIApplication sharedApplication] beginIgnoringInteractionEvents];

就在你开始动画之前

[[UIApplication sharedApplication] endIgnoringInteractionEvents];

在动画完成后,例如在其完成块中.

after the animation finishes, e.g., in its completion block.

这篇关于如何禁用 UITextField 键盘而不隐藏它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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