what is the difference if i return "YES" or "NO" when i call textFieldShouldReturn

Viewed 4444

This is the text field delegate method but i have doubt about return type

-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
  [textField resignFirstResponder];

   return NO;
}  

and this is the same method with different return type

-(BOOL)textFieldShouldReturn:(UITextField *)textField
 {
   [textField resignFirstResponder];

   return YES;
 }

by both we can hide key board in i phone . but what is the meaning of return type "YES" or "NO". I am not seeing any difference.

4 Answers

The most important difference I've found is that if the text field emits the control event UIControlEventEditingDidEndOnExit, this will cause the text field to resign first responder unless textFieldShouldReturn is implemented to return NO.

Related