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.
The textFieldShouldReturn is a place where you can handle the Return button on the keyboard.
textFieldShouldReturn asks the delegate if the text field should process the pressing of the return button.
If you implement your own code to process the return button you should return NO, or return YES for it to be handled in the default way.
The IOS Docs state:
The text field calls this method whenever the user taps the return button. You can use this method to implement any custom behavior when the button is tapped.
http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UITextFieldDelegate_Protocol/UITextFieldDelegate/UITextFieldDelegate.html