Why textFieldShouldReturn is still working when i return false?

The keyboard is being dismissed due to the call to resignFirstResponder. It has nothing at all to do with the return value of textFieldShouldReturn.

In my experience, the return value of textFieldShouldReturn almost has no use. In the vast majority of cases it makes no difference whether you return true, or false.

I return false in all my uses of testFieldShouldReturn. If you return true and your implementation of textFieldShouldReturn sets the first responder to a UITextView, the text view ends up getting the newline added to it. Returning false from textFieldShouldReturn ensures this won't happen. But this was based on experience with iOS 4 or 5 a few years ago. I don't know if that still happens with the latest versions of iOS.


The return value from textFieldShouldReturn answers a different question. If the text field has an action for the control event editingDidEndOnExit, that will cause the keyboard to dismiss unless textFieldShouldReturn is implemented to return false.