How do I bind an action to the Go button of the keyboard in iOS ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Objective-C
Assuming you’re using a UITextField, you could use the
<UITextFieldDelegate>methodtextFieldShouldReturn.Don’t forget to assign the class you put this code in as the text field’s delegate.
Or if you’d prefer to use UIControlEvents, you can do the following
See @Wojtek Rutkowski’s answer to see how to do this in Interface Builder.
Swift
UITextFieldDelegate
UIControlEvents