如何禁用/启用 UITextField 中的返回键? [英] How to disable/enable the return key in a UITextField?

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

问题描述

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

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.

推荐答案

也许下面的代码段有帮助:

Maybe the following code segment helps:

textfield.enablesReturnKeyAutomatically = YES;

这是在 UITextInputTraits 中的 iPhone SDK 中公开可用的.使用此功能,当文本字段中没有可用的输入文本时,将禁用返回键.

This is publicly available in iPhone SDK in UITextInputTraits. Using this, return key will be disabled when no input text is available within text field.

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

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