Reputation: 4852
On IOS where do i hook up a selector to the keyboards enter button?
Cheers
Upvotes: 4
Views: 4147
Reputation: 19
Add UITextFieldDelegate to your .h and add bellow code to your .m:
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return YES;
};
Upvotes: 1
Reputation: 1714
In the textFieldShouldReturn method listed by Till, you would do
[textField resignFirstResponder];
to hide the keyboard.
Upvotes: 4
Reputation: 27597
Use the UITextFieldDelegate
-Protocol and implement:
-(BOOL)textFieldShouldReturn:(UITextField *)textField
See the UITextFieldDelegate Reference.
Upvotes: 9