Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the keyboard Done button behavior?

Alright, so my goal is that when the keyboard Done button is tapped after introducing something in a UITextField, it should trigger one of my actions but not dismiss the keyboard.

Right now, I've connected the UITextField with my action through the Did End on Exit event and each time I tap the Done button when I'm finished typing, the keyboard goes away.

Let me know if you need further clarification.

like image 643
Sergey Katranuk Avatar asked Jan 27 '12 18:01

Sergey Katranuk


1 Answers

Try setting textField.delegate = self in code, as well as conforming to the UITextFieldDelegate protocol. Then implement this method:

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    // Do something
}
like image 54
aopsfan Avatar answered Nov 11 '22 13:11

aopsfan