重载iPhone的"GO"按钮执行动作 [英] Overloading the IPhone "GO" button to perform an action

查看:83
本文介绍了重载iPhone的"GO"按钮执行动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计使用html和javascript的应用程序.我有一个登录表单,上面有一个登录"按钮.文本字段接受用户名,然后按登录按钮,即会执行登录操作.但是,我现在要做的是在iPhone中使用虚拟键盘时,单击执行"按钮也必须启动登录"操作. 请让我知道相同的解决方案. 谢谢.

I am designing an application using html and javascript. I have a login form with a Login button on it. A textfield accepts a username and then pressing the login button, login action takes place. However, what i want to do now is that while using the virtual keypad in IPhone, clicking the GO button must initiate the Login action too. Please let me know the solution for the same. Thanks.

推荐答案

为UITextField设置一个委托对象(指向您的视图控制器)并使用方法

Set a delegate object (point to your view controller) for your UITextField and use the method

- (BOOL)textFieldShouldReturn:(UITextField *)textField

-textFieldShouldReturn将在用户点击"Go"或"Return"之前被调用.请记住返回是".

-textFieldShouldReturn will be called just before the user the user taps the "Go" or "Return". Remember to return "YES".

这篇关于重载iPhone的"GO"按钮执行动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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