IOS:用iPad KeyBoard的回车键动作 [英] IOS: action with enter key of iPad KeyBoard

查看:99
本文介绍了IOS:用iPad KeyBoard的回车键动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个文本字段,在第一个文本字段中我写Hello,当我按下进入iPad键盘时,我希望在第二个文本字段中显示World;如何在我的应用程序中使用enter来创建操作?

I have two textfield, in first textfield I write "Hello" and when I push enter in iPad keyboard, I want that in second textfield appear "World"; How can I use enter to create an action in my application?

推荐答案

您通常会将视图控制器指定为文本字段的委托然后实现 textFieldShouldReturn:方法,例如:

You would typically assign your view controller as the text field's delegate and then implement the textFieldShouldReturn: method, e.g.:

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    otherTextField.text = @"World"
    return YES;
}

这篇关于IOS:用iPad KeyBoard的回车键动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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