Overloading the IPhone “GO” button to perform an action

半世苍凉 提交于 2019-12-12 11:31:42

问题


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.


回答1:


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

- (BOOL)textFieldShouldReturn:(UITextField *)textField

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



来源:https://stackoverflow.com/questions/4667247/overloading-the-iphone-go-button-to-perform-an-action

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!