Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOS keyboard enter selector

On IOS where do i hook up a selector to the keyboards enter button?

Cheers

like image 289
user346443 Avatar asked Dec 10 '22 09:12

user346443


2 Answers

Use the UITextFieldDelegate-Protocol and implement:

-(BOOL)textFieldShouldReturn:(UITextField *)textField

See the UITextFieldDelegate Reference.

like image 127
Till Avatar answered Dec 25 '22 11:12

Till


In the textFieldShouldReturn method listed by Till, you would do

[textField resignFirstResponder];

to hide the keyboard.

like image 44
Christian Avatar answered Dec 25 '22 10:12

Christian