停止在iOS上自动关闭键盘/disablesAutomaticKeyboardDismissal不被调用 [英] Stop automatic dismissal of keyboard on iOS/disablesAutomaticKeyboardDismissal not called

查看:374
本文介绍了停止在iOS上自动关闭键盘/disablesAutomaticKeyboardDismissal不被调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够让另一个控件成为第一响应者,同时又保持键盘对用户的显示.

I would like to be able to have another control become the first responder yet keep the keyboard showing to the user.

我发现在UIViewController中禁用了automaticKeyboardDismissal并覆盖了它,但它从未被称为(iOS 5.0)

I found disablesAutomaticKeyboardDismissal in UIViewController and overrode it but it never get's called (iOS 5.0)

是否存在无法调用此方法的原因?即使急救人员不需要键盘,还有另一种方法可以保持键盘显示吗?

Is there a reason this method would not get called? Is there another way to keep the keyboard showing even though it's not required by the first responder?

推荐答案

虽然感觉有点像黑客,但我所做的是在UIView上进行覆盖canBecomeFirstResponder以返回YES,然后实现UIKeyProtocol

Though it felt a bit like a hack what I did was make override canBecomeFirstResponder on UIView to return YES and then implement the UIKeyProtocol

https://developer.apple. com/library/IOS/documentation/UIKit/Reference/UIKeyInput_Protocol/Reference/Reference.html

但是在按键上什么也没做.这样,键盘保持打开状态,但键无关紧要.

But did nothing on key press. This way the keyboard stays open but the keys don't matter.

这篇关于停止在iOS上自动关闭键盘/disablesAutomaticKeyboardDismissal不被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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