views:

92

answers:

1

Hi everyone,

I have a view with a UITextField which should hide the keyboard when return is pressed.

My function is this:

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
 if ( textField == userPassword ) {
  [textField resignFirstResponder];
 }
 return YES;
}

Normally the keyboard should be hidden but it stays on the screen. resignFirstResponder is correctly called. What am I missing?

A: 

If you are using the Interface Builder, look if your UITextField has the delegated linked with your class.

-Select your UITextField and in your Connections look if exits one connection in Outlets->delegate. If not, conect with you File's Owner Class.

This need to be linked with your File's Owner Class. This delegate tell where to search for a method. If your are overriding a method, you need to tell where the object will search for that.

Marcos Issler
The responder is correctly called, its not a matter of the delegate. Thank you for trying :-)
favo