本文介绍了如何在UITextField中禁用/启用返回键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法以编程方式启用或禁用 UIKeyboard 上的返回键?我可以找到的最接近的是,但只能告诉是否完全禁用它。

Is there a way to programmatically enable or disable the Return Key on the UIKeyboard? The closest I could find is enablesReturnKeyAutomatically, but that only will tell whether to disable it at all.

推荐答案

如果你可以得到UIKeyboard对象本身(在SDK中没有暴露的东西,注意你,所以苹果可能不会高兴,如果你使用这些调用),那么有一个方便setReturnKeyEnabled:member function。

If you can get the UIKeyboard object itself (something not exposed in the SDK, mind you, so Apple may not be happy if you use these calls), then there's a convenient setReturnKeyEnabled: member function.

id keyboard = [self magicallyGetAUIKeyboardInstance];
[keyboard setReturnKeyEnabled: NO];

(通过

magicallyGetAUIKeyboardInstance 这里

这篇关于如何在UITextField中禁用/启用返回键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 06:44