动态更改UIKeyboards返回键 [英] dynamically change UIKeyboards return key

查看:125
本文介绍了动态更改UIKeyboards返回键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个UITextfield,用户将他的名字输入第一个,然后发送电子邮件到第二个。我想知道如何更改UIKeyboards返回键,具体取决于名称文本字段是否有条目。

I have two UITextfield the user enters his name into the first and email into the second. I would like to know how to change the UIKeyboards return key depending if the name text field has an entry or not.

例如,如果nametextfield为空,那么我想要如果nametextfield中有一个条目,则UIkeyboard返回键为Next
else,然后当用户选择电子邮件文本字段时,我希望返回密钥提交。

For instance if nametextfield is empty then I would like the UIkeyboard return key to be Next else if the nametextfield has an entry in it then when the user selects the email text field I would like the return key to be submit.

这可能吗?如果是这样我将如何完成它?任何帮助将不胜感激。

Is this possible? if so how would I go about accomplishing it? any help would be appreciated.

推荐答案

您可以将返回键自定义为您可以在 UIReturnKeyType 枚举每个 UITextField

You can have return key customized to prefixed values that you can see in UIReturnKeyType enum for each UITextField.

textFieldName.returnKeyType = UIReturnKeyNext;
textFieldEmail.returnKeyType = UIReturnKeyDefault;

不确定这是否是你想要的。

Not sure if this is what you're looking for though.

这篇关于动态更改UIKeyboards返回键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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